uctypes

 1import uctypes
 2
 3raw = b"\x04\x09\x09\x4d\x69\x63\x72\x6f"
 4
 5desc = {
 6    "len": 0 | uctypes.UINT8,
 7    "type": 1 | uctypes.UINT8,
 8    "name": (2 | uctypes.ARRAY, 5 | uctypes.UINT8),  # from offset=2 start, 5 UINT8s
 9}
10
11pkt = uctypes.struct(uctypes.addressof(raw), desc)
12
13print("len :", pkt.len)  # 4
14print("type:", pkt.type)  # 9
15print("name:", bytes(pkt.name))  # b'Micro'