def _get_list_table_columns_and_formatters(fields, objs, exclude_fields=(), filters=None):
 if (not fields):
  return ([], {})
 if (not objs):
  obj = None
 elif isinstance(objs, list):
  obj = objs[0]
 else:
  obj = objs
 columns = []
 formatters = {}
 non_existent_fields = []
 exclude_fields = set(exclude_fields)
 for field in fields.split(','):
  if (not hasattr(obj, field)):
   non_existent_fields.append(field)
   continue
  if (field in exclude_fields):
   continue
  (field_title, formatter) = utils.make_field_formatter(field, filters)
  columns.append(field_title)
  formatters[field_title] = formatter
  exclude_fields.add(field)
 if non_existent_fields:
  raise exceptions.CommandError((_('Non-existent fields are specified: %s') % non_existent_fields))
 return (columns, formatters)

def _get_list_table_columns_and_formatters ( fields , objs , exclude_fields = ( ) , filters = None ) : if ( not fields ) : return ( [ ] , { } ) if ( not objs ) : obj = None elif isinstance ( objs , list ) : obj = objs [ 0 ] else : obj = objs columns = [ ] formatters = { } non_existent_fields = [ ] exclude_fields = set ( exclude_fields ) for field in fields . split ( ',' ) : if ( not hasattr ( obj , field ) ) : non_existent_fields . append ( field ) continue if ( field in exclude_fields ) : continue ( field_title , formatter ) = utils . make_field_formatter ( field , filters ) columns . append ( field_title ) formatters [ field_title ] = formatter exclude_fields . add ( field ) if non_existent_fields : raise exceptions . CommandError ( ( _ ( 'Non-existent fields are specified: %s' ) % non_existent_fields ) ) return ( columns , formatters )
check and add fields to output columns .