def warn(self, text):
    if self.log:
        if self.log_packet_count:
            logging.info(('Data packets received:' + str(self.log_packet_count)))
            self.log_packet_count = 0
        logging.warning(text)
    print(('Warning: %s' % text))
def warn(self, text):
    if self.log:
        if self.log_packet_count:
            logging.info(('Data packets received:' + str(self.log_packet_count)))
            self.log_packet_count = 0
        logging.warning(text)
    print(('Warning: %s' % text))