Better python function detection