code: def clone_repo(url, branch):
      cwd = os.getcwd()
      tmpdir = tempfile.mkdtemp()
      try:
          cmd = f"git clone {url} {tmpdir}"
          call(cmd, shell=True)
          os.chdir(tmpdir)
          cmd = "git checkout %s" % branch
          call(cmd, shell=True)
      except:
          shutil.rmtree(tmpdir)
          raise
      finally:
          os.chdir(cwd)
      return tmpdir
  
file_path: nipype/tools/gitwash_dumper.py
imports: import os
  from os.path import join
  import shutil
  import sys
  import re
  import glob
  import fnmatch
  import tempfile
  from subprocess import call
  from optparse import OptionParser
label_desc: Use image node_id 1 for calling a global function with example usage: clone_repo(url, branch) and returns: tmpdir