async def login(cls, credentials: AuthenticationCredentials,
                    config: Config) -> 'Session':
        """Checks the given credentials for a valid login and returns a new
        session.

        """
        redis = await create_redis(config.address)
        namespace = await cls._check_user(redis, config, credentials)
        if config.select is not None:
            await redis.select(config.select)
        mailbox_set = MailboxSet(redis, namespace)
        try:
            await mailbox_set.add_mailbox('INBOX')
        except MailboxConflict:
            pass
        filter_set = FilterSet(redis, namespace)
        return cls(redis, credentials.identity, config,
                   mailbox_set, filter_set)
Checks the given credentials for a valid login and returns a new
        session.