Python Inversion of Control