<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set(self, key, val, env=None):
 """ Changes the value for the setting specified by 'key' to the new value. By default this will change the current environment, but you can change values in other environments by passing the name of that environment as the 'env' parameter. """

        if env is None:
            env = self.environment
        else:
            if env not in self._settings:
                raise exc.EnvironmentNotFound("There is no environment named "
                        "'%s'." % env)
        dct = self._settings[env]
        if key not in dct:
            raise exc.InvalidSetting("The setting '%s' is not defined." % key)
        dct[key] = val
        if key == "identity_type":
            # If setting the identity_type, also change the identity_class.
            dct["identity_class"] = _import_identity(val)
        elif key == "region":
            if not identity:
                return
            current = identity.region
            if current == val:
                return
            if "LON" in (current, val):
                # This is an outlier, as it has a separate auth
                identity.region = val
        elif key == "verify_ssl":
            if not identity:
                return
            identity.verify_ssl = val