def METHOD_NAME(self, e, connection, cursor):
    if super().METHOD_NAME(e, connection, cursor):
        return True
    elif isinstance(e, self.dbapi.Error):
        str_e = str(e).lower()
        return "not connected" in str_e or "isn't valid" in str_e
    else:
        return False