docs: def _hm_verify_message_crc_uk(
              self,
              thermostat_id,
              protocol,
              source,
              expectedFunction,
              expectedLength,
              datal
      ):
          """Verifies message appears legal"""
          # expectedLength only used for read msgs as always 7 for write
          badresponse = 0
          if protocol == constants.HMV3_ID:
              checksum = datal[len(datal) - 2:]
              rxmsg = datal[:len(datal) - 2]
              crc = CRC16()   # Initialises the CRC
              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
              ):
                  # Reply to Write is always 7 long
                  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 (func_code == constants.FUNC_READ and
              #   expectedLength !=len(datal) ):
              #   # Read response length is wrong
              #   logging.info("response length
              #    not EXPECTED value")
              #   logging.info("Got %s when expecting %s",
              #   len(datal), expectedLength)
              #   logging.info("Data is:\n %s", datal)
              #   s = "Incorrect length: %s\n" % (frame_len)
              #   sys.stderr.write(s)
              #   badresponse += 1
  
              if (badresponse == 0):
                  return True
              else:
                  return False
  
          else:
              assert 0, "Un-supported protocol found %s" % protocol