      try:
          return _format_cache[cache_key]
  
      # The requested format_type has not been cached yet. Try to find it in any
      # of the format_modules for the given lang if l10n is enabled. If it's not
      # there or if l10n is disabled, fall back to the project settings.
 
</s> remove     with suppress(KeyError):
 </s> add     try: </s> remove         with suppress(KeyError):
 </s> add         try: </s> remove             with suppress(GDALException):
 </s> add             try:
    except KeyError:
        pass
      try:
          return _format_cache[cache_key]
    except KeyError:
        pass
  
      # The requested format_type has not been cached yet. Try to find it in any
      # of the format_modules for the given lang if l10n is enabled. If it's not
      # there or if l10n is disabled, fall back to the project settings.
keep add keep keep keep keep
 Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."

This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda
because try/except performs better. 
django/utils/formats.py