code: def generate_exp_id(prefix=None, argv=sys.argv) -> str:
      """Generate reproducible, unique and deterministic experiment id
  
      The generated id will be string generated from prefix, Git
      checksum, git diff from HEAD and command line arguments.
  
      Returns:
          A generated experiment id in string (str) which if avialable
          for directory name
  
      """
  
      if not is_under_git_control():
          raise RuntimeError(
              "Cannot generate experiment id due to Git lacking."
          )
  
      names = []
      if prefix is not None:
          names.append(prefix)
  
      head = subprocess.check_output(
          "git rev-parse HEAD".split()
      ).strip()
      names.append(head.decode())
  
      # Caveat: does not work with new files that are not yet cached
      sources = [
          subprocess.check_output("git diff HEAD".split()),
          pickle.dumps(argv),
      ]
  
      for source in sources:
          names.append("%08x" % crc32(source))
  
      return "-".join(names)
  
file_path: pfrl/pfrl/experiments/prepare_output_dir.py
imports: import argparse
  import datetime
  import json
  import os
  import pickle
  import shutil
  import subprocess
  import sys
  from binascii import crc32
  import pfrl
label_desc: Use image node_id 2 for calling a global function with example usage: generate_exp_id(prefix, argv) and returns: str