code: def main():
      parser = argparse.ArgumentParser(
          formatter_class=argparse.RawTextHelpFormatter
      )
  
      parser.add_argument(
          "-v",
          "--version",
          action="version",
          version="Kaggle API " + KaggleApi.__version__,
      )
  
      subparsers = parser.add_subparsers(
          title="commands", help=Help.kaggle, dest="command"
      )
      subparsers.required = True
      subparsers.choices = Help.kaggle_choices
      parse_competitions(subparsers)
      parse_datasets(subparsers)
      parse_kernels(subparsers)
      parse_models(subparsers)
      parse_files(subparsers)
      parse_config(subparsers)
      args = parser.parse_args()
      command_args = {}
      command_args.update(vars(args))
      del command_args["func"]
      del command_args["command"]
      error = False
      try:
          out = args.func(**command_args)
      except ApiException as e:
          msg = "{} - {}".format(str(e.status), e.reason)
          body = __parse_body(e.body)
          if body and "message" in body:
              msg += " - {}".format(body["message"])
          print(msg)
          out = None
          error = True
      except ValueError as e:
          print(e)
          out = None
          error = True
      except KeyboardInterrupt:
          print("User cancelled operation")
          out = None
      if out is not None:
          print(out, end="")
  
      # This is so that scripts that pick up on error codes can tell when there was a failure
      if error:
          exit(1)
  
file_path: kaggle-api/kaggle/cli.py
imports: from __future__ import print_function
  import argparse
  import json
  from kaggle import api
  from kaggle import KaggleApi
  from .rest import ApiException
  import six
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types