Python 3.9 is now generally available.

google.appengine.datastore.datastore_index.Normalize

Normalizes filter and order query components.

The resulting components have the same effect as the given components if used in a query.

filters The filters set on the query.
orders The orders set on the query.
exists The names of properties that require an exists filter if not already specified.

(filter, orders) the reduced set of filters and orders.