<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def current(cls, with_exception=True):
 """ Returns the current database context. """

        if with_exception and len(cls.stack) == 0:
            raise NoContext()
        return cls.stack.top()