def _snapping_round(num, eps, resolution):
    """
    Return num snapped to within eps of an integer, or int(resolution(num)).
    """

    rounded = round(num)
    delta = abs(num - rounded)
    if delta < eps:
        return int(rounded)
    else:
        return int(resolution(num))