docs: def adjust_ages(AgesIn):
      """
      Function to adjust ages to a common age_unit
      """
  # get a list of age_units first
      age_units, AgesOut, factors, factor, maxunit, age_unit = [], [], [], 1, 1, "Ma"
      for agerec in AgesIn:
          if agerec[1] not in age_units:
              age_units.append(agerec[1])
              if agerec[1] == "Ga":
                  factors.append(1e9)
                  maxunit, age_unit, factor = 1e9, "Ga", 1e9
              if agerec[1] == "Ma":
                  if maxunit == 1:
                      maxunit, age_unt, factor = 1e6, "Ma", 1e6
                  factors.append(1e6)
              if agerec[1] == "Ka":
                  factors.append(1e3)
                  if maxunit == 1:
                      maxunit, age_unit, factor = 1e3, "Ka", 1e3
              if "Years" in agerec[1].split():
                  factors.append(1)
      if len(age_units) == 1:  # all ages are of same type
          for agerec in AgesIn:
              AgesOut.append(agerec[0])
      elif len(age_units) > 1:
          for agerec in AgesIn:  # normalize all to largest age unit
              if agerec[1] == "Ga":
                  AgesOut.append(agerec[0] * 1e9 / factor)
              if agerec[1] == "Ma":
                  AgesOut.append(agerec[0] * 1e6 / factor)
              if agerec[1] == "Ka":
                  AgesOut.append(agerec[0] * 1e3 / factor)
              if "Years" in agerec[1].split():
                  if agerec[1] == "Years BP":
                      AgesOut.append(old_div(agerec[0], factor))
                  if agerec[1] == "Years Cal BP":
                      AgesOut.append(old_div(agerec[0], factor))
                  if agerec[1] == "Years AD (+/-)":
                      # convert to years BP first
                      AgesOut.append(old_div((1950 - agerec[0]), factor))
                  if agerec[1] == "Years Cal AD (+/-)":
                      AgesOut.append(old_div((1950 - agerec[0]), factor))
      return AgesOut, age_unit