for key, value in my_dict.items():
    composite_key = struct.pack('>Q', value) + key
db[composite_key] = ''
db.close()
db = hashopen('dict.db')
for key, _ in db.items():
    size = struct.calcsize('>Q')
value, key = key[:size], key[size:]
value = struct.unpack('>Q', value)[0]
print(key, value)
db.close()
Как отсортировать БОЛЬШОЙ словарь