'Add information about a configuration option.
This can take several forms:
add(name, confname)
Configuration option \'confname\' maps to attribute \'name\'
add(name, None, short, long)
Command line option \'-short\' or \'--long\' maps to \'name\'
add(None, None, short, long, handler)
Command line option calls handler
add(name, None, short, long, handler)
Assign handler return value to attribute \'name\'
In addition, one of the following keyword arguments may be given:
default=...  -- if not None, the default value
required=... -- if nonempty, an error message if no value provided
flag=...     -- if not None, flag value for command line option
env=...      -- if not None, name of environment variable that
overrides the configuration file or default'

def add(self, name=None, confname=None, short=None, long=None, handler=None, default=None, required=None, flag=None, env=None):

    if (flag is not None):
        if (handler is not None):
            raise ValueError('use    at    most    one    of    flag=    and    handler=')
        if ((not long) and (not short)):
            raise ValueError('flag=    requires    a    command    line    flag')
        if (short and short.endswith(':')):
            raise ValueError('flag=    requires    a    command    line    flag')
        if (long and long.endswith('=')):
            raise ValueError('flag=    requires    a    command    line    flag')
        handler = (lambda arg, flag=flag: flag)
    if (short and long):
        if (short.endswith(':') != long.endswith('=')):
            raise ValueError(('inconsistent    short/long    options:    %r    %r' % (short, long)))
    if short:
        if (short[0] == '-'):
            raise ValueError("short    option    should    not    start    with    '-'")
        (key, rest) = (short[:1], short[1:])
        if (rest not in ('', ':')):
            raise ValueError("short    option    should    be    'x'    or    'x:'")
        key = ('-' + key)
        if (key in self.options_map):
            raise ValueError(("duplicate    short    option    key    '%s'" % key))
        self.options_map[key] = (name, handler)
        self.short_options.append(short)
    if long:
        if (long[0] == '-'):
            raise ValueError("long    option    should    not    start    with    '-'")
        key = long
        if (key[(-1)] == '='):
            key = key[:(-1)]
        key = ('--' + key)
        if (key in self.options_map):
            raise ValueError(("duplicate    long    option    key    '%s'" % key))
        self.options_map[key] = (name, handler)
        self.long_options.append(long)
    if env:
        self.environ_map[env] = (name, handler)
    if name:
        if (not hasattr(self, name)):
            setattr(self, name, None)
        self.names_list.append((name, confname))
        if (default is not None):
            self.default_map[name] = default
        if required:
            self.required_map[name] = required
