Working with Managed Identities from within a function is documented here: https://docs.microsoft.com/en-us/azure/app-service/overview-managed-identity#obtaining-tokens-for-azure-resource
There is currently no example for Python. Given that MIs are now supported on Linux App Service and Premium plans, we should provide a Python sample as well.
/cc @ggailey777