code: def main(argv=None):
      """Run as a command-line script: colorize a python file or stdin using ANSI
      color escapes and print to stdout.
  
      Inputs:
  
        - argv(None): a list of strings like sys.argv[1:] giving the command-line
          arguments. If None, use sys.argv[1:].
      """
  
      usage_msg = """%prog [options] [filename]
  
  Colorize a python file or stdin using ANSI color escapes and print to stdout.
  If no filename is given, or if filename is -, read standard input."""
  
      import optparse
  
      parser = optparse.OptionParser(usage=usage_msg)
      newopt = parser.add_option
      newopt(
          "-s",
          "--scheme",
          metavar="NAME",
          dest="scheme_name",
          action="store",
          choices=["Linux", "LightBG", "NoColor"],
          default=_scheme_default,
          help="give the color scheme to use. Currently only 'Linux'\
   (default) and 'LightBG' and 'NoColor' are implemented (give without\
   quotes)",
      )
  
      opts, args = parser.parse_args(argv)
  
      if len(args) > 1:
          parser.error("you must give at most one filename.")
  
      if len(args) == 0:
          fname = "-"  # no filename given; setup to read from stdin
      else:
          fname = args[0]
  
      if fname == "-":
          stream = sys.stdin
      else:
          try:
              stream = open(fname)
          except IOError as msg:
              print(msg, file=sys.stderr)
              sys.exit(1)
  
      parser = Parser()
  
      # we need nested try blocks because pre-2.5 python doesn't support unified
      # try-except-finally
      try:
          try:
              # write colorized version to stdout
              parser.format(stream.read(), scheme=opts.scheme_name)
          except IOError as msg:
              # if user reads through a pager and quits, don't print traceback
              if msg.args != (32, "Broken pipe"):
                  raise
      finally:
          if stream is not sys.stdin:
              stream.close()
  
file_path: catboost/contrib/python/ipython/py2/IPython/utils/PyColorize.py
imports: from __future__ import print_function
  from __future__ import absolute_import
  from __future__ import unicode_literals
  import keyword
  import os
  import sys
  import token
  import tokenize
  from IPython.utils.coloransi import TermColors, InputTermColors, ColorScheme, ColorSchemeTable
  from IPython.utils.py3compat import PY3
  from .colorable import Colorable
label_desc: Use image node_id 1 for calling a global function with example usage: main(argv) without return types