Python functions don't work after declaration


I want to build a metric tree in redash, but for this i need to preprocess input data that i get from database. I tried to declare functions but got error. At docs is written “The Python query runner lets you run arbitrary Python 3 scripts”, is it possible to work with python functions in redash?