<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ensure_pool(func):
 """Decorator that ensures a pool is available for a stepper."""

    def func_wrapper(*args, **kwargs):
        if len(args) == 0 or not isinstance(args[0], Stepper):
            raise Exception('@ensure_pool can only be used on Stepper methods.')
        if args[0]._pool is None:
            with args[0]:
                return func(*args, **kwargs)
        else:
            return func(*args, **kwargs)
    return func_wrapper