Python 3.9 is now generally available.

google.appengine.api.full_app_id.parse

Parses a full app ID into partition, domain_name, and display_app_id.

app_id The full partitioned app ID. Looks up from environ if None.
environ Environment dictionary. Uses os.environ if None.

A tuple (partition, domain_name, display_app_id). The partition and domain name might be empty.