code: def filename_search_replace(sr_pairs, filename, backup=False):
      """Search and replace for expressions in files"""
      in_txt = open(filename, "rt").read(-1)
      out_txt = in_txt[:]
      for in_exp, out_exp in sr_pairs:
          in_exp = re.compile(in_exp)
          out_txt = in_exp.sub(out_exp, out_txt)
      if in_txt == out_txt:
          return False
      open(filename, "wt").write(out_txt)
      if backup:
          open(filename + ".bak", "wt").write(in_txt)
      return True
  
file_path: nibabel/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 3 for calling a global function with example usage: filename_search_replace(sr_pairs, filename, backup) and returns: True, False