def get_all_elements(node):
 if isinstance(node, (astroid.Tuple, astroid.List)):
  for child in node.elts:
   for e in get_all_elements(child):
    (yield e)
 else:
  (yield node)

def get_all_elements ( node ) : if isinstance ( node , ( astroid . Tuple , astroid . List ) ) : for child in node . elts : for e in get_all_elements ( child ) : ( yield e ) else : ( yield node )
recursively returns all atoms in nested lists and tuples .