old_contents: import sys
  
  from core import KDPVGenerator
  
  
  def print_help():
      print('Usage: python run.py [data.yml]')
  
  
  def generate(filename):
      generator = KDPVGenerator.from_yml(filename)
      generator.generate()
  
  
  def main():
      if len(sys.argv) < 2:
          filename = 'data.yml'
  
      else:
          filename = sys.argv[1]
  
      if filename in {'help', '-h', '--help'}:
          print_help()
  
      else:
          generate(filename)
  
  
  if __name__ == '__main__':
      main()
  
new_contents: import argparse
  import os
  from core import KDPVGenerator
  
  
  def generate(filename):
      generator = KDPVGenerator.from_yml(filename)
      generator.generate()
  
  
  def main():
      parser = argparse.ArgumentParser(description='KDPV Generator')
      parser.add_argument('filename', nargs='?', default='data.yml', help='data file (default: data.yml)')
      args = parser.parse_args()
      if not args.filename:
          parser.print_help()
      else:
          if not os.path.isfile(args.filename):
              exit('Unable to open file: {}'.format(args.filename))
          generate(args.filename)
  
  
  if __name__ == '__main__':
      main()
  
subject: Add argparse, handle data file missing