code: def parse(data):
      
  
      # convert to string
      data = data.decode("ascii")
  
      if len(data) == 2 and data == "A5":
          return AckMessage()
  
      # split into bytes
      raw = [data[i:i+2] for i in range(len(data)) if i % 2 == 0]
  
      if len(raw) != 7:
          return UnknownMessage(raw)
  
      if raw[1] == "B8":
          return StateMessage(raw)
      elif raw[3] == "12":
          return CommandMessage(raw)
      elif raw[3] == "14":
          return ScenarioTriggeredMessage(raw)
      elif raw[3] == "15":
          return RequestStatusMessage(raw)
      else:
          return UnknownMessage(raw)
docs: Parses a raw datagram and return the right type of message