<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_failure(self, entity):
 """ Callback function when there is a failure in a connection to whatsapp server """

        logger.error("Login failed, reason: %s" % entity.getReason())
        self.connected = False