def format_num(val):
    """Return a suitable format string depending on the size of the value."""
    if val > 50:
        return ".0f"
    if val > 1:
        return ".1f"
    else:
        return ".2f"