code: def FileWriter(path):
      """Context manager for a ninja_syntax object writing to a file."""
      try:
          os.makedirs(os.path.dirname(path))
      except OSError:
          pass
      f = open(path, "w")
      yield ninja_syntax.Writer(f)
      f.close()
  
imports: import argparse
  import contextlib
  import os
  import random
  import sys
  import ninja_syntax
label_desc: Use image node_id 6 for calling a global function with example usage: FileWriter(path) without return types