docs: def _collapse_root(master, current, dsn, pc):
      """
      Collapse the root items of the current time series entry
  
      :param dict master: LiPD data (so far)
      :param dict current: Current time series entry
      :param str dsn: Dataset name
      :param str pc: paleoData or chronData (mode)
      :return dict master:
      :return dict current:
      """
      logger_ts.info("enter collapse_root")
      _tmp_fund = {}
      _tmp_pub = {}
      # The tmp lipd data that we'll place in master later
      _tmp_master = {'pub': [], 'geo': {'geometry': {'coordinates': []}, 'properties': {}}, 'funding': [],
                     'paleoData': {}, "chronData": {}}
      # _raw = _switch[pc]
      _c_keys = ['meanLat', 'meanLon', 'meanElev']
      _c_vals = [0, 0, 0]
      _p_keys = ['siteName', 'pages2kRegion', "location", "gcmdLocation", ""]
      try:
  
          # does not have
          # paleoData, chronData, mode, tableType, time_id, depth, depthUnits, age, ageUnits
  
          # does have
          # pub, geo, funding, proxy, archiveType, description, investigator,
  
          # For all keys in the current time series entry
          for k, v in current.items():
  
              # Underscore present. Only underscore keys that belong here are funding, geo, and pub
              if "_" in k:
                  # FUNDING
                  if 'funding' in k:
                      # Group funding items in tmp_funding by number
                      m = re_fund_valid.match(k)
                      try:
                          _tmp_fund[m.group(1)][m.group(2)] = v
                      except Exception:
                          try:
                              # If the first layer is missing, create it and try again
                              _tmp_fund[m.group(1)] = {}
                              _tmp_fund[m.group(1)][m.group(2)] = v
                          except Exception:
                              # Still not working. Give up.
                              pass
  
                  # GEO
                  elif 'geo' in k:
                      key = k.split('_')
                      # Coordinates - [LON, LAT, ELEV]
                      if key[1] in _c_keys:
                          if key[1] == 'meanLon' or key[1] == "longitude":
                              _c_vals[0] = v
                          elif key[1] == 'meanLat' or key[1] == "latitude":
                              _c_vals[1] = v
                          elif key[1] == 'meanElev' or key[1] == "elevation":
                              _c_vals[2] = v
                      # Properties
                      else:
                          _tmp_master['geo']['properties'][key[1]] = v
                      # All others
                      # else:
                      #     _tmp_master['geo'][key[1]] = v
  
                  # PUBLICATION
                  elif 'pub' in k:
                      # Group pub items in tmp_pub by number
                      m = re_pub_valid.match(k.lower())
                      if m:
                          number = int(m.group(1)) - 1  # 0 indexed behind the scenes, 1 indexed to user.
                          key = m.group(2)
                          # Authors ("Pu, Y.; Nace, T.; etc..")
                          if key == 'author' or key == 'authors':
                              try:
                                  _tmp_pub[number]['author'] = _collapse_author(v)
                              except KeyError as e:
                                  # Dictionary not created yet. Assign one first.
                                  _tmp_pub[number] = {}
                                  _tmp_pub[number]['author'] = _collapse_author(v)
                          # DOI ID
                          elif key == 'DOI':
                              try:
                                  _tmp_pub[number]['identifier'] = [{"id": v, "type": "doi", "url": "http://dx.doi.org/" + str(v)}]
                              except KeyError:
                                  # Dictionary not created yet. Assign one first.
                                  _tmp_pub[number] = {}
                                  _tmp_pub[number]['identifier'] = [{"id": v, "type": "doi", "url": "http://dx.doi.org/" + str(v)}]
                          # All others
                          else:
                              try:
                                  _tmp_pub[number][key] = v
                              except KeyError:
                                  # Dictionary not created yet. Assign one first.
                                  _tmp_pub[number] = {}
                                  _tmp_pub[number][key] = v
  
              # No underscore in name, we can rule out the other obvious keys we don't want
              else:
                  # Rule out any timeseries keys that we added, and paleoData/chronData prefixed keys.
                  if not any(i in k.lower() or i is k.lower() for i in ["paleodata", "chrondata", "mode", "tabletype", "time_id", "depth", "depthunits", "age", "ageunits"]):
                      # Root item:
                      _tmp_master[k] = v
                      continue
  
  
  
          # Append the compiled data into the master dataset data
          for k, v in _tmp_pub.items():
              _tmp_master['pub'].append(v)
          for k, v in _tmp_fund.items():
              _tmp_master['funding'].append(v)
  
          # Get rid of elevation coordinate if one was never added.
          if _c_vals[2] == 0:
              del _c_vals[2]
          _tmp_master['geo']['geometry']['coordinates'] = _c_vals
  
          # Create entry in object master, and set our new data to it.
          master[dsn] = _tmp_master
      except Exception as e:
          logger_ts.error("collapse_root: Exception: {}, {}".format(dsn, e))
      logger_ts.info("exit collapse_root")
      return master, current