'If :data:`provider_name` specified, launches the login procedure for
corresponding :doc:`provider </reference/providers>` and returns
:class:`.LoginResult`.
If :data:`provider_name` is empty, acts like
:meth:`.Authomatic.backend`.
.. warning::
The method redirects the **user** to the **provider** which in
turn redirects **him/her** back to the *request handler* where
it has been called.
:param str provider_name:
Name of the provider as specified in the keys of the :doc:`config`.
:param callable callback:
If specified the method will call the callback with
:class:`.LoginResult` passed as argument and will return nothing.
:param bool report_errors:
.. note::
Accepts additional keyword arguments that will be passed to
:doc:`provider <providers>` constructor.
:returns:
:class:`.LoginResult`'

def login(self, adapter, provider_name, callback=None, session=None, session_saver=None, **kwargs):

    if provider_name:
        provider_settings = self.config.get(provider_name)
        if (not provider_settings):
            raise ConfigError('Provider    name    "{0}"    not    specified!'.format(provider_name))
        if (not ((session is None) or (session_saver is None))):
            session = session
            session_saver = session_saver
        else:
            session = Session(adapter=adapter, secret=self.secret, max_age=self.session_max_age, name=self.prefix, secure=self.secure_cookie)
            session_saver = session.save
        class_ = provider_settings.get('class_')
        if (not class_):
            raise ConfigError('The    "class_"    key    not    specified    in    the    config    for    provider    {0}!'.format(provider_name))
        ProviderClass = resolve_provider_class(class_)
        ProviderClass._logger = self._logger
        provider = ProviderClass(self, adapter=adapter, provider_name=provider_name, callback=callback, session=session, session_saver=session_saver, **kwargs)
        return provider.login()
    else:
        self.backend(adapter)
