code: def file_add_license(fname):
      if not should_have_license(fname):
          return
      with open(fname, "r", encoding="utf-8") as f:
          lines = f.readlines()
      if _lines_have_apache_license(lines):
          return
      _, ext = os.path.splitext(fname)
      with open(fname, "w", encoding="utf-8") as f:
          # shebang line
          if lines[0].startswith("#!"):
              f.write(lines[0].rstrip() + "\n\n")
              del lines[0]
          f.write(_get_license(_LANGS[ext]))
          for l in lines:
              f.write(l.rstrip() + "\n")
      logging.info("added license header to " + fname)
      return
  
imports: import re
  import os
  import argparse
  from itertools import chain
  import logging
  import sys
  import subprocess
label_desc: Use image node_id 9 for calling a global function with example usage: file_add_license(fname) without return types