from typing import List


def ranges(nums: list) -> List[tuple]:
    """Given list of integers, returns list with consecutive integers as ranges.
    If list has single number range `x`, will return `(x, x)`.
    For Input: [2, 3, 4, 7, 8, 9, 15]
    Output looks like: [(2, 4), (7, 9), (15, 15)]
    """
    nums = sorted(set(nums))
    gaps = [[s, e] for s, e in zip(nums, nums[1:]) if s + 1 < e]
    edges = iter(nums[:1] + sum(gaps, []) + nums[-1:])
    return list(zip(edges, edges))