def _get_disk_of_partition(devpath, st=None):
 diskpath = re.sub('(?:(?<=\\d)p)?\\d+$', '', devpath)
 if (diskpath != devpath):
  try:
   st_disk = os.stat(diskpath)
   if stat.S_ISBLK(st_disk.st_mode):
    return (diskpath, st_disk)
  except OSError:
   pass
 if (st is None):
  st = os.stat(devpath)
 return (devpath, st)

def _get_disk_of_partition ( devpath , st = None ) : diskpath = re . sub ( '(?:(?<=\\d)p)?\\d+$' , '' , devpath ) if ( diskpath != devpath ) : try : st_disk = os . stat ( diskpath ) if stat . S_ISBLK ( st_disk . st_mode ) : return ( diskpath , st_disk ) except OSError : pass if ( st is None ) : st = os . stat ( devpath ) return ( devpath , st )
gets a disk device path and status from partition path .