def get_open_edges(nut_1, index_1, nut_2, index_2):
    """Suppose that nut_1 and nut_2 match up at index_1 and index_2: return open edges on left and right.

    Args:
        nut_1: Nut
        index_1: int
        nut_2: Nut
        index_2: int

    Returns:
        tuple(tuple(int, int), tuple(int, int)) Left edge, Right edge.

    >>> a = Nut([1, 2, 3, 4, 5, 6], 'a')
    >>> b = Nut([1, 2, 5, 6, 3, 4], 'b')
    >>> c = Nut([1, 3, 5, 2, 4, 6], 'c')

    >>> get_open_edges(a, 0, b, 0)
    ((2, 6), (2, 4))

    >>> get_open_edges(a, 0, c, 0)
    ((3, 6), (2, 6))

    >>> get_open_edges(a, 1, c, 3)
    ((4, 1), (3, 5))

    """
    val_1 = nut_1[index_1]
    val_2 = nut_2[index_2]
    if val_1 != val_2:
        raise ValueError(
            f"Pieces do not match {nut_1}[{index_1}], {nut_2}[{index_2}]")

    left_edge = (nut_2[index_2 + 1], nut_1[index_1 - 1])
    right_edge = (nut_1[index_1 + 1], nut_2[index_2 - 1])

    return left_edge, right_edge