'Register a watch for the file/directory named path. Raises an OSError if path
does not exist.'

def watch(self, path):

    path = realpath(path)
    with self.lock:
        if (path not in self.watches):
            bpath = (path if isinstance(path, bytes) else path.encode(self.fenc))
            flags = (self.MOVE_SELF | self.DELETE_SELF)
            buf = ctypes.c_char_p(bpath)
            wd = self._add_watch(self._inotify_fd, buf, (flags | self.ONLYDIR))
            if (wd == (-1)):
                eno = ctypes.get_errno()
                if (eno != errno.ENOTDIR):
                    self.handle_error()
                flags |= (self.MODIFY | self.ATTRIB)
                wd = self._add_watch(self._inotify_fd, buf, flags)
                if (wd == (-1)):
                    self.handle_error()
            self.watches[path] = wd
            self.modified[path] = False
