def _percent(data, part, total):
    """
    Calculate a percentage.
    """
    try:
        return round(100 * float(data[part]) / float(data[total]), 1)
    except ZeroDivisionError:
        return 0
