def encode(self, data, errors='strict'): """'40 41 42' -> b'@ab'""" return serial.to_bytes([int(h, 16) for h in data.split()])