Context manager for handling interactive prog indication

        This context manager streamlines presenting banners and prog
        indicators. To start the prog, pass ``msg`` argument as a start
        message. For example::

            printer = Console(verbose=True)
            with printer.progress('Checking files') as prog:
                # Do some checks
                if errors:
                    prog.abrt()
                prog.end()

        The context manager returns a ``Progress`` instance, which provides
        methods like ``abrt()`` (abort), ``end()`` (end), and ``prog()`` (print
        prog indicator).

        The prog methods like ``abrt()`` and ``end()`` will raise an
        exception that interrupts the prog. These exceptions are
        ``ProgressEnd`` exception subclasses and are ``ProgressAbrt`` and
        ``ProgressOK`` respectively. They are silenced and not handled in any
        way as they only serve the purpose of flow control.

        Other exceptions are trapped and ``abrt()`` is called. The exceptions
        that should be trapped can be customized using the ``excs`` argument,
        which should be a tuple of exception classes.

        If a handler function is passed using ``onerror`` argument, then this
        function takes the raised exception and handles it. By default, the
        ``error()`` factory is called with no arguments to generate the default
        error handler. If string is passed, then ``error()`` factory is called
        with that string.

        Finally, when prog is aborted either naturally or when exception is
        raised, it is possible to reraise the ``ProgressAbrt`` exception. This
        is done using the ``reraise`` flag. Default is to reraise.

def progress(self, msg, onerror=None, sep='...', end='DONE', abrt='FAIL',
                 prog='.', excs=(Exception,), reraise=True):
        """ Context manager for handling interactive prog indication

        This context manager streamlines presenting banners and prog
        indicators. To start the prog, pass ``msg`` argument as a start
        message. For example::

            printer = Console(verbose=True)
            with printer.progress('Checking files') as prog:
                # Do some checks
                if errors:
                    prog.abrt()
                prog.end()

        The context manager returns a ``Progress`` instance, which provides
        methods like ``abrt()`` (abort), ``end()`` (end), and ``prog()`` (print
        prog indicator).

        The prog methods like ``abrt()`` and ``end()`` will raise an
        exception that interrupts the prog. These exceptions are
        ``ProgressEnd`` exception subclasses and are ``ProgressAbrt`` and
        ``ProgressOK`` respectively. They are silenced and not handled in any
        way as they only serve the purpose of flow control.

        Other exceptions are trapped and ``abrt()`` is called. The exceptions
        that should be trapped can be customized using the ``excs`` argument,
        which should be a tuple of exception classes.

        If a handler function is passed using ``onerror`` argument, then this
        function takes the raised exception and handles it. By default, the
        ``error()`` factory is called with no arguments to generate the default
        error handler. If string is passed, then ``error()`` factory is called
        with that string.

        Finally, when prog is aborted either naturally or when exception is
        raised, it is possible to reraise the ``ProgressAbrt`` exception. This
        is done using the ``reraise`` flag. Default is to reraise.
        """
        if not onerror:
            onerror = self.error()
        if type(onerror) is str:
            onerror = self.error(msg=onerror)
        self.pverb(msg, end=sep)
        prog = progress.Progress(self.pverb, end=end, abrt=abrt, prog=prog)
        try:
            yield prog
            prog.end()
        except self.ProgressOK:
            pass
        except self.ProgressAbrt as err:
            if reraise:
                raise err
        except KeyboardInterrupt:
            raise
        except excs as err:
            prog.abrt(noraise=True)
            if onerror:
                onerror(err)
            if self.debug:
                traceback.print_exc()
            if reraise:
                raise self.ProgressAbrt()