Python Codintion
python\nfrom threading import Condition\nfrom typing import Callable\n\n\nclass FooBar:\n    def __init__(self, n):\n        self.n = n\n        self.cv = Condi
```python\nfrom threading import Condition\nfrom typing import Callable\n\n\nclass FooBar:\n    def __init__(self, n):\n        self.n = n\n        self.cv = Condition()\n        self.printed_foo = False\n\n    def foo(self, printFoo: \'Callable[[], None]\') -> None:\n\n        for i in range(self.n):\n            # printFoo() outputs "foo". Do not change or remove this line.\n            with self.cv:\n                self.cv.wait_for(lambda: self.printed_foo is False)\n                printFoo()\n                self.printed_foo = True\n                self.cv.notify()\n\n    def bar(self, printBar: \'Callable[[], None]\') -> None:\n\n        for i in range(self.n):\n            # printBar() outputs "bar". Do not change or remove this line.\n            with self.cv:\n                self.cv.wait_for(lambda: self.printed_foo is True)\n                printBar()\n                self.printed_foo = False\n                self.cv.notify()\n```
[]