<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(self, args=None):
 """ Runs the main command or sub command based on user input """


        if not args:
            args = self.parse(sys.argv[1:])

        if getattr(args, 'verbose', False):
            self.logger.setLevel(logging.DEBUG)

        try:
            if hasattr(args, 'run'):
                args.run(self, args)
            else:
                self.__main__(args)  # pylint: disable-msg=E1101
        except Exception as e:  # pylint: disable-msg=W0703
            import traceback
            self.logger.debug(traceback.format_exc())
            self.logger.error(str(e))
            if self.raise_exceptions:
                raise
            sys.exit(2)