code: def exit(self, code=0, message=None):
          
  
          ## If we have a parser, use it to exit
          if self._parser:
              if code > 0:
                  self.parser.error(message)
              else:
                  self.parser.exit(code, message)
  
          ## Else we are exiting before parser creation
          else:
              if message is not None:
                  if code > 0:
                      sys.stderr.write(message)
                  else:
                      sys.stdout.write(message)
              sys.exit(code)
  
          ## If we're here we didn't exit for some reason?
          raise Exception("Unable to exit the %s" % self.__class__.__name__)
docs: Exit the console program sanely.