human
Complete this python program:
def Settings(d=None, _environ_=os.environ, **kw):
assistant
#Here is the Python code you requested.

    """Deployment settings.  Update application settings (usually
    from PasteDeploy keywords) with framework-specific key/value pairs
    (e.g. find ``PYRAMID_DEBUG_AUTHORIZATION`` in os.environ and jam into
    keyword args).
    """
    if (d is None):
        d = {}
    d = dict(d)
    d.update(**kw)
    eget = _environ_.get
    def expand_key(key):
        keys = [key]
        if (not key.startswith('pyramid.')):
            keys.append(('pyramid.' + key))
        return keys
    def S(settings_key, env_key=None, type_=str, default=False):
        value = default
        keys = expand_key(settings_key)
        for key in keys:
            value = d.get(key, value)
        if env_key:
            value = eget(env_key, value)
        value = type_(value)
        d.update({k: value for k in keys})
    def O(settings_key, override_key):
        for key in expand_key(settings_key):
            d[key] = (d[key] or d[override_key])
    S('debug_all', 'PYRAMID_DEBUG_ALL', asbool)
    S('debug_authorization', 'PYRAMID_DEBUG_AUTHORIZATION', asbool)
    O('debug_authorization', 'debug_all')
    S('debug_notfound', 'PYRAMID_DEBUG_NOTFOUND', asbool)
    O('debug_notfound', 'debug_all')
    S('debug_routematch', 'PYRAMID_DEBUG_ROUTEMATCH', asbool)
    O('debug_routematch', 'debug_all')
    S('debug_templates', 'PYRAMID_DEBUG_TEMPLATES', asbool)
    O('debug_templates', 'debug_all')
    S('reload_all', 'PYRAMID_RELOAD_ALL', asbool)
    S('reload_templates', 'PYRAMID_RELOAD_TEMPLATES', asbool)
    O('reload_templates', 'reload_all')
    S('reload_assets', 'PYRAMID_RELOAD_ASSETS', asbool)
    O('reload_assets', 'reload_all')
    S('reload_resources', 'PYRAMID_RELOAD_RESOURCES', asbool)
    O('reload_resources', 'reload_all')
    for k in (expand_key('reload_assets') + expand_key('reload_resources')):
        d[k] = (d['reload_assets'] or d['reload_resources'])
    S('default_locale_name', 'PYRAMID_DEFAULT_LOCALE_NAME', str, 'en')
    S('prevent_http_cache', 'PYRAMID_PREVENT_HTTP_CACHE', asbool)
    S('prevent_cachebust', 'PYRAMID_PREVENT_CACHEBUST', asbool)
    S('csrf_trusted_origins', 'PYRAMID_CSRF_TRUSTED_ORIGINS', aslist, [])
    return d