def make_filesystem(device, block_device):
 options = []
 if (block_device and (not device.isBlockDevice())):
  raise Exception('{} is not a block device but it was expected to be'.format(device.path))
 elif (device.isBlockDevice() and (not block_device)):
  raise Exception('{} is a block device but it was not expected to be'.format(device.path))
 if (not block_device):
  options.extend(['-F'])
 command = ((['mkfs'] + options) + ['-t', 'ext4', device.path])
 run_process(command)

def make_filesystem ( device , block_device ) : options = [ ] if ( block_device and ( not device . isBlockDevice ( ) ) ) : raise Exception ( '{} is not a block device but it was expected to be' . format ( device . path ) ) elif ( device . isBlockDevice ( ) and ( not block_device ) ) : raise Exception ( '{} is a block device but it was not expected to be' . format ( device . path ) ) if ( not block_device ) : options . extend ( [ '-F' ] ) command = ( ( [ 'mkfs' ] + options ) + [ '-t' , 'ext4' , device . path ] ) run_process ( command )
synchronously initialize a device file with an ext4 filesystem .