code: def close_db(fn):
      
      @wraps(fn)
      def inner(*args, **kwargs):
          try:
              return fn(*args, **kwargs)
          finally:
              if not HUEY.immediate:
                  close_old_connections()
      return inner
docs: Decorator to be used with tasks that may operate on the database.