def get_formatted_contents(
    raw_contents,
    use_color,
    color_config,
    squeeze,
    subs
):
    """
    Apply formatting to raw_contents and return the result. Formatting is
    applied in the order: color, squeeze, subs.
    """
    result = raw_contents

    if use_color:
        result = get_colorized_contents(result, color_config)

    if squeeze:
        result = get_squeezed_contents(result)

    if subs:
        result = get_substituted_contents(result, subs)

    return result

    Apply formatting to raw_contents and return the result. Formatting is
    applied in the order: color, squeeze, subs.
    
eg/util.py