import gi gi.require_version('GLib', '2.0') from gi.repository import GLib data = (1, 2, 3) variant = GLib.Variant("(iii)", data) bytes = variant.get_data()
import gi gi.require_version('GLib', '2.0') from gi.repository import GLib bytes = b'\x02\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00\x00' variant = GLib.Variant("(iii)", bytes=bytes) data = variant.unpack()This code creates a variant from the byte string using the `GLib.Variant` constructor. Then it unpacks the variant into a tuple of three integers using the `unpack()` method. The GLib Variant package is part of the GObject Introspection (GI) library, which is a Python wrapper for the GLib library.