old_contents: """Main entry point for dvc CLI."""
  
  from __future__ import unicode_literals
  
  import logging
  
  from dvc.cli import parse_args
  from dvc.lock import LockError
  from dvc.config import ConfigError
  from dvc.analytics import Analytics
  from dvc.exceptions import NotDvcRepoError, DvcParserError
  from dvc.remote.pool import close_pools
  from dvc.utils.compat import is_py2
  
  
  logger = logging.getLogger("dvc")
  
  
  def main(argv=None):
      """Run dvc CLI command.
  
      Args:
          argv: optional list of arguments to parse. sys.argv is used by default.
  
      Returns:
          int: command's return code.
      """
      args = None
      cmd = None
  
      outerLogLevel = logger.level
      try:
          args = parse_args(argv)
  
          if args.quiet:
              logger.setLevel(logging.CRITICAL)
  
          elif args.verbose:
              logger.setLevel(logging.DEBUG)
  
          cmd = args.func(args)
          ret = cmd.run()
      except LockError:
          logger.exception("failed to lock before running a command")
          ret = 250
      except ConfigError:
          logger.exception("configuration error")
          ret = 251
      except KeyboardInterrupt:
          logger.exception("interrupted by the user")
          ret = 252
      except NotDvcRepoError:
          logger.exception("")
          ret = 253
      except DvcParserError:
          ret = 254
      except UnicodeError:
          if is_py2:
              logger.exception(
                  "unicode is not fully supported in DVC for Python 2.\n"
                  "Python 2.7 will not be maintained past 2020.\n"
                  "Please upgrade to Python 3 to work correctly with unicode.\n"
                  "Exception"
              )
          ret = 255
      except Exception:  # pylint: disable=broad-except
          logger.exception("unexpected error")
          ret = 255
      finally:
          logger.setLevel(outerLogLevel)
          # Python 2 fails to close these clean occasionally and users see
          # weird error messages, so we do it manually
          close_pools()
  
      Analytics().send_cmd(cmd, args, ret)
  
      return ret
  
new_contents: """Main entry point for dvc CLI."""
  
  from __future__ import unicode_literals
  
  import logging
  
  from dvc.cli import parse_args
  from dvc.lock import LockError
  from dvc.config import ConfigError
  from dvc.analytics import Analytics
  from dvc.exceptions import NotDvcRepoError, DvcParserError
  from dvc.remote.pool import close_pools
  from dvc.utils.compat import is_py2
  
  
  logger = logging.getLogger("dvc")
  
  
  def main(argv=None):
      """Run dvc CLI command.
  
      Args:
          argv: optional list of arguments to parse. sys.argv is used by default.
  
      Returns:
          int: command's return code.
      """
      args = None
      cmd = None
  
      outerLogLevel = logger.level
      try:
          args = parse_args(argv)
  
          if args.quiet:
              logger.setLevel(logging.CRITICAL)
  
          elif args.verbose:
              logger.setLevel(logging.DEBUG)
  
          cmd = args.func(args)
          ret = cmd.run()
      except LockError:
          logger.exception("failed to lock before running a command")
          ret = 250
      except ConfigError:
          logger.exception("configuration error")
          ret = 251
      except KeyboardInterrupt:
          logger.exception("interrupted by the user")
          ret = 252
      except NotDvcRepoError:
          logger.exception("")
          ret = 253
      except DvcParserError:
          ret = 254
      except UnicodeError:
          if not is_py2:
              raise
          logger.exception(
              "unicode is not supported in DVC for Python 2"
              " (end-of-life January 1, 2020), please upgrade to Python 3"
          )
          ret = 255
      except Exception:  # pylint: disable=broad-except
          logger.exception("unexpected error")
          ret = 255
      finally:
          logger.setLevel(outerLogLevel)
          # Python 2 fails to close these clean occasionally and users see
          # weird error messages, so we do it manually
          close_pools()
  
      Analytics().send_cmd(cmd, args, ret)
  
      return ret
  
subject: make sure to raise UinocedeError for py3