1import cbor
2
3data = {
4    "name": "python-cbor",
5    "versions": ["1", "2"],
6    "group": {
7        "is_a_package": True,
8        "value": 42
9    }
10}
11serialized = cbor.dumps(data)
12print(serialized.decode(errors="ignore"))
13with open("/tmp/data.cbor", "wb") as f:
14    f.write(serialized)
15