code: 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 ValueError:
          return tuple(chain(tup, (elem,))), len(tup)
  
imports: from itertools import chain
  import re
  from numbers import Number
  import numexpr
  from numexpr.necompiler import getExprNames
  from numpy import full, inf
  from catalyst.pipeline.term import Term, ComputableTerm
label_desc: Use image node_id 1 for calling a global function with example usage: _ensure_element(tup, elem) and returns: tup,  tup, tuple,  len