Get DataRow from GridViewRow of GridView

public  DataRow GridViewRowToDataRow(GridViewRow gvr)
{
    object di = null;
    DataRowView drv = null;
    DataRow dr = null;
    if (gvr != null)
    {
        di = gvr.DataItem as System.Object;
        if (di != null)
        {
            drv = di as System.Data.DataRowView;
            if (drv != null)
            {
                dr = drv.Row as System.Data.DataRow;
            }
        }
    }
    return dr;
}