@classmethod
def from_v1(cls, env, **kwargs):
    """
        Alternate constructor which uses Fabric 1's ``env`` dict for settings.

        All keyword arguments besides ``env`` are passed unmolested into the
        primary constructor, with the exception of ``overrides``, which is used
        internally & will end up resembling the data from ``env`` with the
        user-supplied overrides on top.

        .. warning::
            Because your own config overrides will win over data from ``env``,
            make sure you only set values you *intend* to change from your v1
            environment!

        For details on exactly which ``env`` vars are imported and what they
        become in the new API, please see :ref:`v1-env-var-imports`.

        :param env:
            An explicit Fabric 1 ``env`` dict (technically, any
            ``fabric.utils._AttributeDict`` instance should work) to pull
            configuration from.

        .. versionadded:: 2.4
        """
    data = kwargs.pop('overrides', {})
    for subdict in ('connect_kwargs', 'run', 'sudo', 'timeouts'):
        data.setdefault(subdict, {})
    data['run'].setdefault('pty', env.always_use_pty)
    data.setdefault('gateway', env.gateway)
    data.setdefault('forward_agent', env.forward_agent)
    if env.key_filename is not None:
        data['connect_kwargs'].setdefault('key_filename', env.key_filename)
    data['connect_kwargs'].setdefault('allow_agent', not env.no_agent)
    data.setdefault('ssh_config_path', env.ssh_config_path)
    data['sudo'].setdefault('password', env.sudo_password)
    passwd = env.password
    data['connect_kwargs'].setdefault('password', passwd)
    if not data['sudo']['password']:
        data['sudo']['password'] = passwd
    data['sudo'].setdefault('prompt', env.sudo_prompt)
    data['timeouts'].setdefault('connect', env.timeout)
    data.setdefault('load_ssh_configs', env.use_ssh_config)
    data['run'].setdefault('warn', env.warn_only)
    kwargs['overrides'] = data
    return cls(**kwargs)
