'Immutable constructor.
If \'config\' is non-None all configuration options will default to the value
it contains unless the configuration option is explicitly set to \'None\' in
the keyword arguments. If \'config\' is None then all configuration options
default to None.
Args:
config: Optional base configuration providing default values for
parameters not specified in the keyword arguments.
**kwargs: Configuration options to store on this object.
Returns:
Either a new Configuration object or (if it would be equivalent)
the config argument unchanged, but never None.'

def __new__(cls, config=None, **kwargs):

    if (config is None):
        pass
    elif isinstance(config, BaseConfiguration):
        if ((cls is config.__class__) and config.__is_stronger(**kwargs)):
            return config
        for (key, value) in config._values.iteritems():
            if issubclass(cls, config._options[key]._cls):
                kwargs.setdefault(key, value)
    else:
        raise datastore_errors.BadArgumentError(('config    argument    should    be    Configuration    (%r)' % (config,)))
    obj = super(BaseConfiguration, cls).__new__(cls)
    obj._values = {}
    for (key, value) in kwargs.iteritems():
        if (value is not None):
            try:
                config_option = obj._options[key]
            except KeyError as err:
                raise TypeError(('Unknown    configuration    option    (%s)' % err))
            value = config_option.validator(value)
            if (value is not None):
                obj._values[key] = value
    return obj
