code: def parse_args():
    
    parser = ArgumentParser(description="ModelBase builder")
    subparsers = parser.add_subparsers()
  
    sql_parser = subparsers.add_parser(
      "get-query",
      description="Usage: e.g. psql -c \"copy ($(python3 lib/generate_models.py get-query)) to " +
                  "stdout with csv header\" DB_NAME postgres")
    sql_parser.set_defaults(func=print_sql_query)
  
    gen_parser = subparsers.add_parser("generate")
    gen_parser.add_argument("filename", nargs="?", help="Read this file for input, or STDIN if not " \
                                                        "given")
    gen_parser.add_argument("-i", "--indent", default="  ")
    gen_parser.add_argument("-c", "--created-at-col-name", default="created_at")
    gen_parser.add_argument("-u", "--updated-at-col-name", default="updated_at")
    gen_parser.set_defaults(func=generate_models)
  
    args = parser.parse_args()
  
    if hasattr(args, "func"):
      return args
    else:
      arg_parser.print_help()
      sys.exit(1)
docs: Parses command line arguments.