code: def find_source_table(expr):
      
  
      def finder(expr):
          if isinstance(expr, ir.TableExpr):
              return lin.halt, expr
          else:
              return lin.proceed, None
  
      first_tables = lin.traverse(finder, expr.op().flat_args())
      options = list(toolz.unique(first_tables, key=methodcaller('op')))
  
      if len(options) > 1:
          raise NotImplementedError('More than one base table not implemented')
  
      return options[0]
docs: Find the first table expression observed for each argument that the
      expression depends on
  
      Parameters
      ----------
      expr : ir.Expr
  
      Returns
      -------
      table_expr : ir.TableExpr
  
      Examples
      --------
      >>> import ibis
      >>> t = ibis.table([('a', 'double'), ('b', 'string')], name='t')
      >>> expr = t.mutate(c=t.a + 42.0)
      >>> expr  # doctest: +NORMALIZE_WHITESPACE
      ref_0
      UnboundTable[table]
        name: t
        schema:
          a : float64
          b : string
      Selection[table]
        table:
          Table: ref_0
        selections:
          Table: ref_0
          c = Add[float64*]
            left:
              a = Column[float64*] 'a' from table
                ref_0
            right:
              Literal[float64]
                42.0
      >>> find_source_table(expr)
      UnboundTable[table]
        name: t
        schema:
          a : float64
          b : string
      >>> left = ibis.table([('a', 'int64'), ('b', 'string')])
      >>> right = ibis.table([('c', 'int64'), ('d', 'string')])
      >>> result = left.inner_join(right, left.a == right.c)
      >>> find_source_table(result)  # doctest: +ELLIPSIS
      Traceback (most recent call last):
      ...
      NotImplementedError: More than one base table not implemented