def METHOD_NAME(self):
    tries = 0
    while True:
        try:
            self.connection = pika.BlockingConnection(self.parameters)
            self.channel = self.connection.channel()
            if self.connection.is_open:
                break
        except (AMQPConnectionError, Exception) as e:
            time.sleep(5)
            tries += 1
            if tries == 20:
                raise AMQPConnectionError(e)