Python 3.9 is now generally available.

google.appengine.datastore.datastore_index.IndexDefinitionsToProtos

Transforms multiple index definitions to composite index records.

app_id Application id for new protocol buffer CompositeIndex.
index_definition A list of datastore_index.Index objects to transform.

A list of transformed entity_pb2.CompositeIndex entities with default values set and index information filled in.