code: def _create_zip_file(ns):
      if not ns.zip:
          return None
  
      if ns.zip.is_file():
          try:
              ns.zip.unlink()
          except OSError:
              log_exception("Unable to remove {}", ns.zip)
              sys.exit(8)
      elif ns.zip.is_dir():
          log_error(
              "Cannot create ZIP file because {} is a directory", ns.zip
          )
          sys.exit(8)
  
      ns.zip.parent.mkdir(parents=True, exist_ok=True)
      return zipfile.ZipFile(ns.zip, "w", zipfile.ZIP_DEFLATED)
  
imports: import argparse
  import os
  import shutil
  import sys
  import tempfile
  import zipfile
  from pathlib import Path
  from .support.appxmanifest import *
  from .support.catalog import *
  from .support.constants import *
  from .support.filesets import *
  from .support.logging import *
  from .support.options import *
  from .support.pip import *
  from .support.props import *
  from .support.nuspec import *
label_desc: Use image node_id 9 for calling a global function with example usage: _create_zip_file(ns) and returns: zipfile, None