code: def _parse_export_fields(fields, media_field, export_media):
      if not fields:
          fields = media_field
  
      if isinstance(fields, dict):
          paths, header = zip(*fields.items())
      elif etau.is_str(fields):
          paths = [fields]
          header = [fields]
      else:
          paths = list(fields)
          header = list(fields)
  
      try:
          media_idx = paths.index(media_field)
          include_media = True
      except ValueError:
          include_media = False
          if export_media:
              paths.append(media_field)
              media_idx = len(paths) - 1
          else:
              media_idx = None
  
      needs_metadata = any(p.startswith("metadata.") for p in paths)
  
      return paths, header, media_idx, include_media, needs_metadata
  
imports: import csv
  import os
  import eta.core.utils
  import fiftyone.core.utils
  import fiftyone.core.sample
  import fiftyone.utils.data
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_export_fields(fields, media_field, export_media) and returns: paths,  header,  media_idx,  include_media,  needs_metadata