This is code that makes it very easy to obtain a GitHub token for a GitHub application in Python.
This code works by performing the full song and dance required to obtain a token to operate in a GitHub organization. This manages the secret in AWS Secrets manager, caches the tokens and credentails, and refreshes them when neeeded.
The best part is the @github_auth decorator, which injects the credentials into your function when you supply the org name
automagically.