Before the compiler produces bytecode, your program exists as a tree. Each node stands for a piece of the program: a function definition, an assignment, an addition, a name. The ast module gives you that tree as ordinary Python objects, which you can read, search and even change. Linters, formatters, test tools and many other programs that work on Python code are built on it.
More lessons in Complete Python Programming