def surface_column_elements(clause):
 stack = deque([clause])
 while stack:
  elem = stack.popleft()
  (yield elem)
  for sub in elem.get_children():
   if isinstance(sub, FromGrouping):
    continue
   stack.append(sub)

def surface_column_elements ( clause ) : stack = deque ( [ clause ] ) while stack : elem = stack . popleft ( ) ( yield elem ) for sub in elem . get_children ( ) : if isinstance ( sub , FromGrouping ) : continue stack . append ( sub )
traverse and yield only outer-exposed column elements .