def format_percent(n, baseline):
    """Format a ratio as a percentage (showing two decimal places).

    Returns a string.

    Accepts baseline zero and returns '??' or '--'.

    """
    if baseline == 0:
        if n == 0:
            return "--"
        else:
            return "??"
    return "%.2f%%" % (100 * n / baseline)