def buffer_to_value(self, obj, buffer, offset, default_endianness=DEFAULT_ENDIANNESS):
        try:
            value, length = struct.unpack_from(str(self.endianness or default_endianness)
                                      + self.struct_format, buffer, offset)[0], struct.calcsize(self.struct_format)
            if self._enum is not None:
                try:
                    return self._enum(value), length
                except ValueError as e:
                    raise PacketDecodeError("{}: {}".format(self.type, e))
            else:
                return value, length
        except struct.error as e:
            raise PacketDecodeError("{}: {}".format(self.type, e))
Converts the bytes in ``buffer`` at ``offset`` to a native Python value. Returns that value and the number of
dataset/ETHPy150Open pebble/libpebble2/libpebble2/protocol/base/types.py/Field.buffer_to_value