core python: semaphore