code: def _get_fieldcodes(skw_matches, ckw_matches, spires=False):
      
      fieldcodes = {}
      output = {}
  
      for skw, _ in skw_matches:
          for fieldcode in skw.fieldcodes:
              fieldcodes.setdefault(fieldcode, set()).add(skw.output(spires))
      for ckw, _ in ckw_matches:
  
          if len(ckw.fieldcodes):
              for fieldcode in ckw.fieldcodes:
                  fieldcodes.setdefault(fieldcode, set()).add(ckw.output(spires))
          else:  # inherit field-codes from the composites
              for kw in ckw.getComponents():
                  for fieldcode in kw.fieldcodes:
                      fieldcodes.setdefault(fieldcode, set()).add(
                          '%s*' % ckw.output(spires))
                      fieldcodes.setdefault('*', set()).add(kw.output(spires))
  
      for fieldcode, keywords in fieldcodes.items():
          output[fieldcode] = ', '.join(keywords)
  
      return [{'fieldcode': key, 'keywords': value}
              for key, value in output.iteritems()]
docs: Return the output for the field codes.
  
      :var skw_matches: dict of {keyword: [info,...]}
      :var ckw_matches: dict of {keyword: [info,...]}
      :keyword spires: bool, to get the spires output
      :return: list of tuples with (fieldcodes, keywords)