'Create an Environment from an input dict.
The dict may be in one of two formats:
1) old-school flat parameters; or
2) newer {resource_registry: bla, parameters: foo}
:param env: the json environment
:param user_env: boolean, if False then we manage python resources too.'

def __init__(self, env=None, user_env=True):

    if (env is None):
        env = {}
    if user_env:
        from heat.engine import resources
        global_env = resources.global_env()
        global_registry = global_env.registry
        event_sink_classes = global_env.event_sink_classes
    else:
        global_registry = None
        event_sink_classes = {}
    self.param_defaults = env.get(env_fmt.PARAMETER_DEFAULTS, {})
    self.registry = ResourceRegistry(global_registry, self.param_defaults)
    self.registry.load(env.get(env_fmt.RESOURCE_REGISTRY, {}))
    self.encrypted_param_names = env.get(env_fmt.ENCRYPTED_PARAM_NAMES, [])
    if (env_fmt.PARAMETERS in env):
        self.params = env[env_fmt.PARAMETERS]
    else:
        self.params = dict(((k, v) for (k, v) in six.iteritems(env) if (k not in (env_fmt.PARAMETER_DEFAULTS, env_fmt.ENCRYPTED_PARAM_NAMES, env_fmt.EVENT_SINKS, env_fmt.RESOURCE_REGISTRY))))
    self.event_sink_classes = event_sink_classes
    self._event_sinks = []
    self._built_event_sinks = []
    self._update_event_sinks(env.get(env_fmt.EVENT_SINKS, []))
    self.constraints = {}
    self.stack_lifecycle_plugins = []
