def get_swap(transformed_list):
 if (not all(((isinstance(device, DriverSwapBlockDevice) or ('swap_size' in device)) for device in transformed_list))):
  return None
 try:
  return transformed_list.pop()
 except IndexError:
  return None

def get_swap ( transformed_list ) : if ( not all ( ( ( isinstance ( device , DriverSwapBlockDevice ) or ( 'swap_size' in device ) ) for device in transformed_list ) ) ) : return None try : return transformed_list . pop ( ) except IndexError : return None
get the swap device out of the list context .