def format_value(data, precision=8):
    """Pretty print a given value.

    :param data: data to format
    :param precision: max. number of digits
    :type precision: int
    :return: pretty printed result
    :rtype: str
    """
    if isinstance(data, float):
        data = ('%.' + str(precision) + 'g') % data
    else:
        data = str(data)
    return ('{:<' + str(precision + 2) + '}').format(data)
