def _ensure_element(tup, elem):
    """
    Create a tuple containing all elements of tup, plus elem.

    Returns the new tuple and the index of elem in the new tuple.
    """
    try:
        return tup, tup.index(elem)
    except __HOLE__:
        return tuple(chain(tup, (elem,))), len(tup)
dataset/ETHPy150Open quantopian/zipline/zipline/pipeline/expression.py/_ensure_element