code: def _hm_form_message(
              self,
              thermostat_id,
              protocol,
              source,
              function,
              start,
              payload
      ):
          
          if protocol == constants.HMV3_ID:
              start_low = (start & constants.BYTEMASK)
              start_high = (start >> 8) & constants.BYTEMASK
              if function == constants.FUNC_READ:
                  payload_length = 0
                  length_low = (constants.RW_LENGTH_ALL & constants.BYTEMASK)
                  length_high = (constants.RW_LENGTH_ALL
                                 >> 8) & constants.BYTEMASK
              else:
                  payload_length = len(payload)
                  length_low = (payload_length & constants.BYTEMASK)
                  length_high = (payload_length >> 8) & constants.BYTEMASK
              msg = [
                  thermostat_id,
                  10 + payload_length,
                  source,
                  function,
                  start_low,
                  start_high,
                  length_low,
                  length_high
              ]
              if function == constants.FUNC_WRITE:
                  msg = msg + payload
                  type(msg)
              return msg
          else:
              assert 0, "Un-supported protocol found %s" % protocol
docs: Forms a message payload, excluding CRC