def two_pair(ranks):
    """If there are two pair, return the two ranks as a
    tuple: (highest, lowest); otherwise return None."""
    two_pair = set()
    for r in ranks:
        if ranks.count(r) == 2: two_pair.add(r)
    two_pair_lst = list(two_pair)
    two_pair_lst.sort(reverse = True)
    return tuple(two_pair_lst) if len(two_pair) == 2 else None