code: def init(self, rules):
          
          # Initialize the option parser
          for dest in rules.keys():
              rule = rules[dest]
  
              # Assign defaults ourselves here, instead of in the option parser
              # itself in order to allow for multiple calls to parse (dont want
              # subsequent calls to override previous values with default vals).
              if 'default' in rule:
                  self.result['kwargs'][dest] = rule['default']
  
              flags = rule['flags']
              kwargs = { 'action': rule.get('action', "store") }
              # NOTE: Don't provision the parser with defaults here, per above.
              for key in ['callback', 'help', 'metavar', 'type']:
                  if key in rule: kwargs[key] = rule[key]
              self.add_option(*flags, dest=dest, **kwargs)
  
              # Remember the dest vars that we see, so that we can merge results
              self.dests.add(dest)
docs: Initialize the parser with the given command rules.