  from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect  # NOQA
  from django.contrib.gis.utils.srs import add_srs_entry  # NOQA
  from django.core.exceptions import ImproperlyConfigured
  
  with suppress(ImproperlyConfigured):
      # LayerMapping requires DJANGO_SETTINGS_MODULE to be set,
      # and ImproperlyConfigured is raised if that's not the case.
      from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError  # NOQA
 
</s> remove from contextlib import suppress

 </s> add  </s> remove with suppress(ImportError):
 </s> add try: </s> remove from contextlib import suppress

 </s> add  </s> remove from contextlib import suppress
 </s> add 
try:
  from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect  # NOQA
  from django.contrib.gis.utils.srs import add_srs_entry  # NOQA
  from django.core.exceptions import ImproperlyConfigured
  
try:
      # LayerMapping requires DJANGO_SETTINGS_MODULE to be set,
      # and ImproperlyConfigured is raised if that's not the case.
      from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError  # NOQA
keep keep keep keep replace keep keep keep
 Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."

This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda
because try/except performs better. 
django/contrib/gis/utils/__init__.py