import collections


def parse_export_data(data):
  """Parse standard export data into dict with header fields as keys.

  Input data should have the following format:
  <Field descriptions row>\r\n
  <Field names>\r\n
  <Field values>\r\n
  ...
  3 lines in the end.
  """
  field_values = collections.defaultdict(list)
  try:
    export_rows = data.split("\r\n")
    field_names = export_rows[1].split(",")

    # Field values are stored starting from second string,
    # last 3 strings are empty in standard export csv.
    rows = export_rows[2: -3]
    for row in rows:
      values = row.split(",")
      for id_, val in enumerate(values):
        field_values[field_names[id_]].append(val.strip('"'))
  except (IndexError, AttributeError):
    pass
  return field_values