code: def getopt(self, name, argv, opts):
          
  
          while argv and argv[0] and argv[0][0] == '-':
              try:
                  argv = opts[argv[0]].parse(name, self, argv)
              except KeyError:
                  raise OptionError('unknown option: %s' % argv[0])
              except IndexError:
                  raise OptionError('missing argument to option: %s' % argv[0])
  
          return argv
docs: getopt(name, argv, opts)
  
          Parse X command line options, inserting the recognised options
          into the resource database.
  
          NAME is the application name, and will be prepended to all
          specifiers.  ARGV is the list of command line arguments,
          typically sys.argv[1:].
  
          OPTS is a mapping of options to resource specifiers.  The key is
          the option flag (with leading -), and the value is an instance of
          some Option subclass:
  
          NoArg(specifier, value): set resource to value.
          IsArg(specifier):        set resource to option itself
          SepArg(specifier):       value is next argument
          ResArg:                  resource and value in next argument
          SkipArg:                 ignore this option and next argument
          SkipLine:                ignore rest of arguments
          SkipNArgs(count):        ignore this option and count arguments
  
          The remaining, non-option, oparguments is returned.
  
          rdb.OptionError is raised if there is an error in the argument list.