def validate_device_partition(device, partition):
 if ((not device) or ('/' in device) or (device in ['.', '..'])):
  raise ValueError(('Invalid device: %s' % quote((device or ''))))
 if ((not partition) or ('/' in partition) or (partition in ['.', '..'])):
  raise ValueError(('Invalid partition: %s' % quote((partition or ''))))

def validate_device_partition ( device , partition ) : if ( ( not device ) or ( '/' in device ) or ( device in [ '.' , '..' ] ) ) : raise ValueError ( ( 'Invalid device: %s' % quote ( ( device or '' ) ) ) ) if ( ( not partition ) or ( '/' in partition ) or ( partition in [ '.' , '..' ] ) ) : raise ValueError ( ( 'Invalid partition: %s' % quote ( ( partition or '' ) ) ) )
validate that a device and a partition are valid and wont lead to directory traversal when used .