def parse_fields(fields_string):
 fields = []
 for main_field in FIELD_DELIMITERS_RE.split(fields_string):
  if ('(' not in main_field):
   fields.append(main_field)
   continue
  (section, sub_fields) = main_field.split('(')
  fields.append({section: tuple(sub_fields[:(-1)].split(','))})
 return tuple(fields)

def parse_fields ( fields_string ) : fields = [ ] for main_field in FIELD_DELIMITERS_RE . split ( fields_string ) : if ( '(' not in main_field ) : fields . append ( main_field ) continue ( section , sub_fields ) = main_field . split ( '(' ) fields . append ( { section : tuple ( sub_fields [ : ( - 1 ) ] . split ( ',' ) ) } ) return tuple ( fields )
converts a fields string to a tuple .