def schedule(self, event_handler, path, recursive=False):
        """
        Schedules watching a path and calls appropriate methods specified
        in the given event handler in response to file system events.

        :param event_handler:
            An event handler instance that has appropriate event handling
            methods which will be called by the observer in response to
            file system events.
        :type event_handler:
            :class:`watchdog.events.FileSystemEventHandler` or a subclass
        :param path:
            Directory path that will be monitored.
        :type path:
            ``str``
        :param recursive:
            ``True`` if events will be emitted for sub-directories
            traversed recursively; ``False`` otherwise.
        :type recursive:
            ``bool``
        :return:
            An :class:`ObservedWatch` object instance representing
            a watch.
        """
        with self._lock:
            watch = ObservedWatch(path, recursive)
            self._add_handler_for_watch(event_handler, watch)
            try:
                # If we have an emitter for this watch already, we don't create a
                # new emitter. Instead we add the handler to the event
                # object.
                emitter = self._get_emitter_for_watch(watch)
            except __HOLE__:
                # Create a new emitter and start it.
                emitter = self._emitter_class(event_queue=self.event_queue,
                                              watch=watch,
                                              timeout=self.timeout)
                self._add_emitter(emitter)
                emitter.start()
            self._watches.add(watch)
        return watch
dataset/ETHPy150Open yildizberkay/MongoApp/libs/watchdog/observers/api.py/BaseObserver.schedule