def traverse_pip(conn, wire_in_tile_pkey):
    """ Given a generic wire, find (if any) the wire on the other side of a pip.

    Returns None if no wire or pip connects to this wire.

    """
    cur = conn.cursor()

    cur.execute(
        """
SELECT src_wire_in_tile_pkey FROM pip_in_tile WHERE
    is_pseudo = 0 AND
    dest_wire_in_tile_pkey = ?
    ;""", (wire_in_tile_pkey, )
    )

    result = cur.fetchone()
    if result is not None:
        return result[0]

    cur.execute(
        """
SELECT dest_wire_in_tile_pkey FROM pip_in_tile WHERE
    is_pseudo = 0 AND
    src_wire_in_tile_pkey = ?
    ;""", (wire_in_tile_pkey, )
    )

    result = cur.fetchone()
    if result is not None:
        return result[0]

    return None