'Get the user-supplied environment for the stack in YAML format.
If the user supplied Parameters then merge these into the
environment global options.'

def environment(self):

    env = {}
    if ((self.PARAM_ENVIRONMENT in self.data) and (not self.data.get(self.PARAM_ENVIRONMENT_FILES))):
        env_data = self.data[self.PARAM_ENVIRONMENT]
        with self.parse_error_check('Environment'):
            if isinstance(env_data, dict):
                env = environment_format.validate(env_data)
            else:
                env = environment_format.parse(env_data)
    environment_format.default_for_missing(env)
    parameters = self.data.get(self.PARAM_USER_PARAMS, {})
    env[self.PARAM_USER_PARAMS].update(parameters)
    return env
