Python Dependency Injection Pattern