code: def get_options(self):
          
          self.add_bool_option("-q", "--quiet",
              help="omit informational logging")
          self.add_bool_option("-v", "--verbose",
              help="increase informational logging")
          self.add_bool_option("--debug",
              help="always show stack-traces for errors")
          self.add_bool_option("--cron",
              help="run in cron mode (with different logging configuration)")
  
          # Template method to add options of derived class
          self.add_options()
  
          self.handle_completion()
          self.options, self.args = self.parser.parse_args()
  
          # Override logging options in debug mode
          if self.options.debug:
              self.options.verbose = True
              self.options.quiet = False
  
          # Set logging levels
          if self.options.cron:
              self.STD_LOG_LEVEL = logging.DEBUG  # pylint: disable=invalid-name
          if self.options.verbose and self.options.quiet:
              self.parser.error("Don't know how to be quietly verbose!")
          elif self.options.quiet:
              logging.getLogger().setLevel(logging.WARNING)
          elif self.options.verbose:
              logging.getLogger().setLevel(logging.DEBUG)
  
          self.LOG.debug("Options: %s" % ", ".join("%s=%r" % i for i in sorted(vars(self.options).items())))
docs: Get program options.