def _join_bonds(b1, b2):
    """ Return a1, a2, a3, where a2 is the atom shared by both bonds
    """
    try:
        a3 = b2.partner(b1.a2)
    except ValueError:
        return b1.a2, b1.a1, b2.partner(b1.a1)
    else:
        return b1.a1, b1.a2, a3