def output_precision(prec=None):
    """Get or set the output precision.

    Package default is 4.  Do nothing is prec is None.

    Returns: default precision.

    >>> default_format("%.*f")
    '%.*f'
    >>> print mg(2, 'm2').sqrt()
    1.4142 m
    >>> output_precision(6)
    6
    >>> print mg(2, 'm2').sqrt()
    1.414214 m
    >>> output_precision(4)
    4
    """
    global _prn_prec
    if prec is not None:
        _prn_prec = prec
    return _prn_prec
