code: def copy_replace(
      replace_pairs,
      repo_path,
      out_path,
      cp_globs=("*",),
      rep_globs=("*",),
      renames=(),
  ):
      out_fnames = cp_files(repo_path, cp_globs, out_path)
      renames = [
          (re.compile(in_exp), out_exp) for in_exp, out_exp in renames
      ]
      fnames = []
      for rep_glob in rep_globs:
          fnames += fnmatch.filter(out_fnames, rep_glob)
      if verbose:
          print("\n".join(fnames))
      for fname in fnames:
          filename_search_replace(replace_pairs, fname, False)
          for in_exp, out_exp in renames:
              new_fname, n = in_exp.subn(out_exp, fname)
              if n:
                  os.rename(fname, new_fname)
                  break
  
file_path: nipy/tools/gitwash_dumper.py
imports: import fnmatch
  import glob
  import os
  import re
  import shutil
  import sys
  import tempfile
  from optparse import OptionParser
  from os.path import join
  from subprocess import call
label_desc: Use image node_id 4 for calling a global function with example usage: copy_replace(replace_pairs, repo_path, out_path, cp_globs, rep_globs, renames) without return types