  def get_language():
      """Return the currently selected language."""
      t = getattr(_active, "value", None)
      if t is not None:
          with suppress(AttributeError):
              return t.to_language()
      # If we don't have a real translation object, assume it's the default language.
      return settings.LANGUAGE_CODE
  
  
 
</s> remove             with suppress(AttributeError):
 </s> add             try:
        try:
  def get_language():
      """Return the currently selected language."""
      t = getattr(_active, "value", None)
      if t is not None:
        try:
              return t.to_language()
      # If we don't have a real translation object, assume it's the default language.
      return settings.LANGUAGE_CODE
  
  
keep keep keep keep replace keep 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/translation/trans_real.py