def _unpack_fields(table, fields=[]):
 u = []
 for f in fields:
  (a, b) = ((('.' in f) and f.split('.', 1)) or (table.name, f))
  if ((a == table.name) and (b == ALL)):
   u.extend((f for f in table.db.tables[a].fields))
  elif ((a != table.name) and (b == ALL)):
   u.extend((('%s.%s' % (a, f)) for f in table.db.tables[a].fields))
  elif (a != table.name):
   u.append(('%s.%s' % (a, b)))
  else:
   u.append(b)
 return u

def _unpack_fields ( table , fields = [ ] ) : u = [ ] for f in fields : ( a , b ) = ( ( ( '.' in f ) and f . split ( '.' , 1 ) ) or ( table . name , f ) ) if ( ( a == table . name ) and ( b == ALL ) ) : u . extend ( ( f for f in table . db . tables [ a ] . fields ) ) elif ( ( a != table . name ) and ( b == ALL ) ) : u . extend ( ( ( '%s.%s' % ( a , f ) ) for f in table . db . tables [ a ] . fields ) ) elif ( a != table . name ) : u . append ( ( '%s.%s' % ( a , b ) ) ) else : u . append ( b ) return u
replaces "*" with the actual field names .