pythonic way to split bytes
You could unpack them twice into (overlapping) unsigned shorts of 16bit and shift/mask them accordingly.

upper12 = struct.unpack("&gt;H", msg[1:-1])[0] &gt;&gt; 4
lower12 = struct.unpack("&gt;H", msg[2:])[0] &amp; 0xFFF


Telling Python to interpret them as short integers helps you to get rid of int.from_bytes.