def interval_intersection(interval1, interval2):
    """Compute the intersection of two open intervals.

    Intervals are pairs of comparable values, one or both may be None to
    denote (negative) infinity.

    Returns the intersection if it is not empty.

    >>> interval_intersection((1, 3), (2, 4))
    (2, 3)

    >>> interval_intersection((1, 2), (2, 3))

    >>> interval_intersection((None, 1), (None, 2))
    (None, 1)

    >>> interval_intersection((1, None), (2, None))
    (2, None)

    >>> interval_intersection((None, None), (None, None))
    (None, None)

    >>> interval_intersection((None, 1), (1, None))
    """
    (lower1, upper1) = interval1
    (lower2, upper2) = interval2
    if lower1 is None:
        lower = lower2
    elif lower2 is None:
        lower = lower1
    else:
        lower = max(lower1, lower2)
    if upper1 is None:
        upper = upper2
    elif upper2 is None:
        upper = upper1
    else:
        upper = min(upper1, upper2)
    if lower is None or upper is None or lower < upper:
        return lower, upper