def describe_symtable(st, recursive=True, indent=0):

    def print_d(s, *args):
        prefix = ' ' * indent
print(prefix + s + ' ' + ' '.join(args))
print_d('Symtable: type=%s, id=%s, name=%s' % (st.get_type(), st.get_id(),
    st.get_name()))
print_d('  nested:', str(st.is_nested()))
print_d('  has children:', str(st.has_children()))
print_d('  identifiers:', str(list(st.get_identifiers())))
if recursive:
    for child_st in st.get_children():
        describe_symtable(child_st, recursive, indent + 5)
Таблица символов в Python