code: def create_static_token_credential(token_):
      from azure.core.credentials import TokenCredential
  
      class StaticTokenCredential(TokenCredential):
          # We initialize with a fixed token (_cached_token).
          #
          # In most cases, we take a fast path - we always just return that fixed token.
          # I.e. we generate the token once somewhere; subsequent operations use that same token.
          #
          # The fixed token can expire (defaults to several hours, but can be configured by an Azure admin)
          #
          # If we detect token expiration, we delegate all future token needs back to DefaultAzureCredential,
          # which similarly supports token caching and regeneration of expired tokens.
          #
          # The net result is that we only generate new tokens when absolutely necessary.
          #
          # This dance is needed because DefaultAzureCredential is picklable and therefore cannot be shared
          # across thread or process pool workers. Simply using a new DefaultAzureCredential in each thread
          # imposes a one time penalty per object. That penalty comes from token generation may be large.
          # e.g. Azure CLI is particularly slow (500ms - 1000ms).
          #
          # https://docs.microsoft.com/en-us/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python
          def __init__(self, token):
              self._cached_token = token
              self._credential = None
  
          def get_token(self, *_scopes, **_kwargs):
              if (self._cached_token.expires_on - time.time()) < 300:
                  from azure.identity import DefaultAzureCredential
  
                  self._credential = DefaultAzureCredential()
              if self._credential:
                  return self._credential.get_token(*_scopes, **_kwargs)
              return self._cached_token
  
          # This object will be stored within a BlobServiceClient object.
          # Implement __hash__ and __eq__ so this and the containing service objects become cacheable.
          def __hash__(self):
              return hash(self._cached_token)
  
          def __eq__(self, other):
              return self._cached_token == other._cached_token
  
      return StaticTokenCredential(token_)
  
file_path: metaflow/metaflow/plugins/azure/azure_utils.py
imports: import sys
  import time
  from metaflow.plugins.azure.azure_exceptions import MetaflowAzureAuthenticationError, MetaflowAzureResourceError, MetaflowAzurePackageError
  from metaflow.exception import MetaflowInternalError, MetaflowException
label_desc: Use image node_id 7 for calling a global function with example usage: create_static_token_credential(token_) and returns: StaticTokenCredential, self, hash, unknown, self