def METHOD_NAME(self):
    if self.ldapConnection is not None:
        try:
            self.ldapConnection.result(timeout=0)
        except ldap.LDAPError as err:
            ldaphost = self.get_property("ldaphost")
            ldapport = self.get_property("ldapport")
            if ldapport is None:
                logging.getLogger("HWR").debug(
                    "LdapLogin: reconnecting to LDAP server %s", ldaphost
                )
                self.connect()
            else:
                logging.getLogger("HWR").debug(
                    "LdapLogin: reconnecting to LDAP server %s:%s",
                    ldaphost,
                    ldapport,
                )
                self.connect()