This is a simple example of how the Google Analytics Core reporting API can be used to create alerts on calculated metrics.
First of all, you need to follow the first two steps here: https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/installed-py
Next, you are able to import this code, where you need to implement your client_secrets.json file.
Then, you need to pick a view id for which you want the call associated. This can easily be extended to concern more than one account.
Please contact me with bugs and errors.
Best Regards Asger Thyregod