def _take_nearest_pair(values, target):
    """Given a sorted, monotonic list of values and a target value,
    returns the closest two pairs of numbers in the list
    to the given target. The first being the closest number
    less than the target, the second being the closest number
    greater than the target.

    For example::

        >>> _take_nearest_pair([1, 2, 3], 2.5)
        (2, 3)

    If the target is not part of the continuous range of the
    values, then both numbers will either be the minimum or
    maximum value in the list.

    For example::

        >>> _take_nearest_pair([1, 2, 3], 10)
        (3, 3)

    """
    low = values[0]
    high = values[0]

    for value in values:
        if value <= target and value >= low:
            low = value
        if value > target:
            high = value
            break
    else:
        # If we never found a value higher than
        # the target, the the target is outside
        # of the range of the list. Therefore,
        # the highest close number is also the
        # lowest close number.
        high = low

    return low, high