code: def confirm_checkout(dest: str, commit: str) -> bool:
      
      usable = False
      if os.path.exists(dest):
          try:
              rev = subprocess.check_output(["git", "rev-parse", "--verify", "HEAD"], cwd=dest).decode("utf-8").strip()
              usable = (rev == commit)
          except subprocess.CalledProcessError:
              pass
          if not usable:
              logging.info("Problem with %s, requires new checkout.", dest)
      return usable
docs: Confirm that git repository is checked out.
  
      :param dest: Local directory for checkout.
      :param commit: Git commit.
      :return: True if checkout is usable.