code: def get_last_calc_id(datadir=None):
      
      datadir = datadir or get_datadir()
      calcs = get_calc_ids(datadir)
      if not calcs:
          return 0
      return calcs[-1]
docs: Extract the latest calculation ID from the given directory.
      If none is found, return 0.