Python 3.9 is now generally available.

google.appengine.api.datastore_types.ValidatePropertyKey

Raises an exception if the supplied datastore.Key instance is invalid.

name Name of the property this is for.
value A datastore.Key instance.

datastore_errors.BadValueError if the value is invalid.