code: def on_failure(self, entity):
          
          logger.error("Login failed, reason: %s" % entity.getReason())
          self.connected = False
docs: Callback function when there is a failure in a connection to whatsapp 
          server