Context manager for temporarily changing the printing system.

    This takes the same parameters as :func:`init_printing`

    Example:

        >>> A = OperatorSymbol('A', hs=1); B = OperatorSymbol('B', hs=1)
        >>> with configure_printing(show_hs_label=False):
        ...     print(ascii(A + B))
        A + B
        >>> print(ascii(A + B))
        A^(1) + B^(1)

def configure_printing(**kwargs):
    """Context manager for temporarily changing the printing system.

    This takes the same parameters as :func:`init_printing`

    Example:

        >>> A = OperatorSymbol('A', hs=1); B = OperatorSymbol('B', hs=1)
        >>> with configure_printing(show_hs_label=False):
        ...     print(ascii(A + B))
        A + B
        >>> print(ascii(A + B))
        A^(1) + B^(1)
    """
    freeze = init_printing(_freeze=True, **kwargs)
    try:
        yield
    finally:
        for obj, attr_map in freeze.items():
            for attr, val in attr_map.items():
                setattr(obj, attr, val)