Python2 clear
\nimport threading\nclass FooBar(object):\n    def __init__(self, n):\n        self.n = n\n        self.f = threading.Semaphore()\n        self.b = threading.Se
```\nimport threading\nclass FooBar(object):\n    def __init__(self, n):\n        self.n = n\n        self.f = threading.Semaphore()\n        self.b = threading.Semaphore()\n        self.b.acquire()\n\n    def foo(self, printFoo):\n        """\n        :type printFoo: method\n        :rtype: void\n        """\n        for i in xrange(self.n):\n            self.f.acquire()\n            # printFoo() outputs "foo". Do not change or remove this line.\n            printFoo()\n            self.b.release()\n\n\n    def bar(self, printBar):\n        """\n        :type printBar: method\n        :rtype: void\n        """\n        for i in xrange(self.n):\n            self.b.acquire()\n            # printBar() outputs "bar". Do not change or remove this line.\n            printBar()\n            self.f.release()\n```
[]