def rangify(values):
    """
    Given a list of integers, returns a list of tuples of ranges (interger pairs).

    :param values:
    :return:
    """
    previous = None
    start = None
    ranges = []
    for r in values:
        if previous is None:
            previous = r
            start = r
        elif r == previous + 1:
            pass
        else:  # r != previous + 1
            ranges.append((start, previous))
            start = r
        previous = r
    ranges.append((start, previous))
    return ranges