old_contents: from functools import wraps
  from django.db import connection
  
  
  def auto_close_db(f):
      "Ensures the database connection is closed when the function returns."
      @wraps(f)
      def wrapper(*args, **kwargs):
          try:
              return f(*args, **kwargs)
          finally:
              connection.close()
      return wrapper
  
new_contents: from functools import wraps
  
  
  def auto_close_db(f):
      "Ensures the database connection is closed when the function returns."
      from django.db import connection
      @wraps(f)
      def wrapper(*args, **kwargs):
          try:
              return f(*args, **kwargs)
          finally:
              connection.close()
      return wrapper
  
subject: Fix circular import when used with other add-ons that import django.db