code: def age_to_BP(age, age_unit):
      
      ageBP = -1e9
      if age_unit == "Years AD (+/-)" or age_unit == "Years Cal AD (+/-)":
          if age < 0:
              age = age+1  # to correct for there being no 0 AD
          ageBP = 1950-age
      elif age_unit == "Years BP" or age_unit == "Years Cal BP":
          ageBP = age
      elif age_unit == "ka":
          ageBP = age*1000
      elif age_unit == "Ma":
          ageBP = age*1e6
      elif age_unit == "Ga":
          ageBP = age*1e9
      else:
          print("Age unit invalid. Age set to -1.0e9")
  
      return ageBP
docs: Convert an age value into the equivalent in time Before Present(BP) where Present is 1950
  
      Returns
      ---------
      ageBP : number