'Login and setup the connection.'

def connect(self):

    import imaplib
    try:
        self.connection = imaplib.IMAP4_SSL(self._server, self._port)
        self.connection.login(self._user, self._password)
        return True
    except imaplib.IMAP4.error:
        _LOGGER.error('Failed    to    login    to    %s', self._server)
        return False
