code: def _hm_verify_message_crc_uk(
              self,
              thermostat_id,
              protocol,
              source,
              expectedFunction,
              expectedLength,
              datal
      ):
          badresponse = 0
          if protocol == constants.HMV3_ID:
              checksum = datal[len(datal) - 2:]
              rxmsg = datal[:len(datal) - 2]
              crc = CRC16()
              expectedchecksum = crc.run(rxmsg)
              if expectedchecksum == checksum:
                  logging.info("CRC is correct")
              else:
                  logging.error("CRC is INCORRECT")
                  serror = "Incorrect CRC"
                  sys.stderr.write(serror)
                  badresponse += 1
              dest_addr = datal[0]
              frame_len_l = datal[1]
              frame_len_h = datal[2]
              frame_len = (frame_len_h << 8) | frame_len_l
              source_addr = datal[3]
              func_code = datal[4]
              if (dest_addr != 129 and dest_addr != 160):
                  logging.info("dest_addr is ILLEGAL")
                  serror = "Illegal Dest Addr: %s\n" % (dest_addr)
                  sys.stderr.write(serror)
                  badresponse += 1
              if dest_addr != thermostat_id:
                  logging.info("dest_addr is INCORRECT")
                  serror = "Incorrect Dest Addr: %s\n" % (dest_addr)
                  sys.stderr.write(serror)
                  badresponse += 1
              if (source_addr < 1 or source_addr > 32):
                  logging.info("source_addr is ILLEGAL")
                  serror = "Illegal Src Addr: %s\n" % (source_addr)
                  sys.stderr.write(serror)
                  badresponse += 1
              if source_addr != source:
                  logging.info("source addr is INCORRECT")
                  serror = "Incorrect Src Addr: %s\n" % (source_addr)
                  sys.stderr.write(serror)
                  badresponse += 1
              if (
                  func_code != constants.FUNC_WRITE
                  and func_code != constants.FUNC_READ
              ):
                  logging.info("Func Code is UNKNWON")
                  serror = "Unknown Func Code: %s\n" % (func_code)
                  sys.stderr.write(serror)
                  badresponse += 1
              if func_code != expectedFunction:
                  logging.info("Func Code is UNEXPECTED")
                  serror = "Unexpected Func Code: %s\n" % (func_code)
                  sys.stderr.write(serror)
                  badresponse += 1
              if (
                      func_code == constants.FUNC_WRITE and frame_len != 7
              ):
                  logging.info("response length is INCORRECT")
                  serror = "Incorrect length: %s\n" % (frame_len)
                  sys.stderr.write(serror)
                  badresponse += 1
              if len(datal) != frame_len:
                  logging.info("response length MISMATCHES header")
                  serror = "Mismatch length: %s %s\n" % (len(datal), frame_len)
                  sys.stderr.write(serror)
                  badresponse += 1
              if (badresponse == 0):
                  return True
              else:
                  return False
          else:
              assert 0, "Un-supported protocol found %s" % protocol