def METHOD_NAME(self, clear_output=False, *clear_args, **clear_kwargs):
    """
    Decorator to capture the stdout and stderr of a function.
    Parameters
    ----------
    clear_output: bool
        If True, clear the content of the output widget at every
        new function call. Default: False
    wait: bool
        If True, wait to clear the output until new output is
        available to replace it. This is only used if clear_output
        is also True.
        Default: False
    """
    def capture_decorator(func):
        @wraps(func)
        def inner(*args, **kwargs):
            if clear_output:
                self.clear_output(*clear_args, **clear_kwargs)
            with self:
                return func(*args, **kwargs)
        return inner
    return capture_decorator