code: def find_immediate_parent_tables(expr):
      
  
      def finder(expr):
          if isinstance(expr, ir.TableExpr):
              return lin.halt, expr
          else:
              return lin.proceed, None
  
      return lin.traverse(finder, expr)
docs: Find every first occurrence of a :class:`ibis.expr.types.TableExpr`
      object in `expr`.
  
      Parameters
      ----------
      expr : ir.Expr
  
      Yields
      ------
      e : ir.Expr
  
      Notes
      -----
      This function does not traverse into TableExpr objects. This means that the
      underlying PhysicalTable of a Selection will not be yielded, for example.
  
      Examples
      --------
      >>> import ibis, toolz
      >>> t = ibis.table([('a', 'int64')], name='t')
      >>> expr = t.mutate(foo=t.a + 1)
      >>> result = list(find_immediate_parent_tables(expr))
      >>> len(result)
      1
      >>> result[0]  # doctest: +NORMALIZE_WHITESPACE
      ref_0
      UnboundTable[table]
        name: t
        schema:
          a : int64
      Selection[table]
        table:
          Table: ref_0
        selections:
          Table: ref_0
          foo = Add[int64*]
            left:
              a = Column[int64*] 'a' from table
                ref_0
            right:
              Literal[int8]
                1