code: def format_git_describe(git_str, pep440=False):
      """format the result of calling 'git describe' as a python version"""
      if git_str is None:
          return None
      if "-" not in git_str:  # currently at a tag
          return git_str
      else:
          # formatted as version-N-githash
          # want to convert to version.postN-githash
          git_str = git_str.replace("-", ".post", 1)
          if pep440:  # does not allow git hash afterwards
              return git_str.split("-")[0]
          else:
              return git_str.replace("-g", "+git")
  
file_path: metaflow/metaflow/metaflow_version.py
imports: from subprocess import check_output, CalledProcessError
  from os import path, name, devnull, environ, listdir
  import json
  from metaflow import CURRENT_DIRECTORY, INFO_FILE
label_desc: Use image node_id 2 for calling a global function with example usage: format_git_describe(git_str, pep440) and returns: None, git_str, git_str, git_str