def delta_percent(decimals=1):
    """A delta formatter to display the delta as a float with a given number of decimals.

    Args:
        decimals: The number of decimals to display.

    Returns:
        A delta formatter function (f(a,b)) returning (b-a)/a displayed as a percentage.

    """
    return (lambda a, b: '{:+.{prec}f}%'.format(100.0 * (b - a) / a, prec=decimals))