def set_stats(stats, value):
    """Updates the stats with the value passed in.

    :param stats: :class: `dict`
    :param value: :class: `int`
    """
    stats["total_count"] += 1
    stats["value"] += value
    stats["average"] = stats["value"] / stats["total_count"]

    # this is just a basic example and not the best way to track aggregation.
    # for max and min old there are cases where this will not work correctly.
    if value > stats["max"]:
        stats["max"] = value

    if value < stats["min"] or stats["min"] == 0:
        stats["min"] = value
Updates the stats with the value passed in.

    :param stats: :class: `dict`
    :param value: :class: `int`