def format_as(use_list, use_tuple, outputs):
 assert (not (use_list and use_tuple)), 'Both flags cannot be simultaneously True'
 if ((use_list or use_tuple) and (not isinstance(outputs, (list, tuple)))):
  if use_list:
   return [outputs]
  else:
   return (outputs,)
 elif ((not (use_list or use_tuple)) and isinstance(outputs, (list, tuple))):
  assert (len(outputs) == 1), 'Wrong arguments. Expected a one element list'
  return outputs[0]
 elif (use_list or use_tuple):
  if use_list:
   return list(outputs)
  else:
   return tuple(outputs)
 else:
  return outputs

def format_as ( use_list , use_tuple , outputs ) : assert ( not ( use_list and use_tuple ) ) , 'Both flags cannot be simultaneously True' if ( ( use_list or use_tuple ) and ( not isinstance ( outputs , ( list , tuple ) ) ) ) : if use_list : return [ outputs ] else : return ( outputs , ) elif ( ( not ( use_list or use_tuple ) ) and isinstance ( outputs , ( list , tuple ) ) ) : assert ( len ( outputs ) == 1 ) , 'Wrong arguments. Expected a one element list' return outputs [ 0 ] elif ( use_list or use_tuple ) : if use_list : return list ( outputs ) else : return tuple ( outputs ) else : return outputs
formats the outputs according to the flags use_list and use_tuple .