code: def fixup_egglink_file(filename, old_dir, new_dir):
      logger.debug("fixing %s" % filename)
      with open(filename, "rb") as f:
          link = f.read().decode("utf-8").strip()
      if _dirmatch(link, old_dir):
          link = link.replace(old_dir, new_dir, 1)
          with open(filename, "wb") as f:
              link = (link + "\n").encode("utf-8")
              f.write(link)
  
imports: from __future__ import with_statement
  import logging
  import optparse
  import os
  import os.path
  import re
  import shutil
  import subprocess
  import sys
  import itertools
label_desc: Use image node_id 12 for calling a global function with example usage: fixup_egglink_file(filename, old_dir, new_dir) without return types