def decode(self, payload):
        try:
            self.reason = ord(payload[0])
            if self.reason == 1:
                self.data = ord(payload[1])
            elif self.reason == 2:
                self.data = struct.unpack(">L", payload[1:])[0]
            elif self.reason == 3:
                self.data = ord(payload[1])
            else:
                log.warning("unknown error reason value {0}"
                            .format(self.reason))
        except (__HOLE__, struct.error):
            raise DecodeError("non matching error reason and data")
dataset/ETHPy150Open javgh/greenaddress-pos-tools/nfc/ndef/handover.py/HandoverError.decode