code: def generate_flattened_dict(headers, results):
      '''extract from results the fields in the headers list'''
      for name, values in results.items():
          row = []
          for header in headers:
              if header == 'name':
                  row.append(name)
              elif ':' in header:
                  neurite_type, metric = header.split(':')
                  row.append(values[neurite_type][metric])
              else:
                  row.append(values[header])
          yield rof generate_flattened_dict(headers, results):
      '''extract from results the fields in the headers list'''
      for name, values in results.items():
          row = []
          for header in headers:
              if header == 'name':
                  row.append(name)
              elif ':' in header:
                  neurite_type, metric = header.split(':')
                  row.append(values[neurite_type][metric])
              else:
                  row.append(values[header])
          yield row
docs: extract from results the fields in the headers list