Python 3.9 is now generally available.

google.appengine.datastore.datastore_stub_util.ToScatteredId

Map counter value v to the scattered ID space.

Translate to scattered ID space, then reverse bits.

v Counter value from which to produce ID.

Integer ID.

datastore_errors.BadArgumentError if counter value exceeds the range of

the scattered ID space.