def AddWatch(self, filename, mask):
    """Adds a file watch.

    @param filename: Path to file
    @param mask: Inotify event mask
    @return: Result

    """
    result = self.watch_manager.add_watch(filename, mask)

    ret = result.get(filename, -1)
    if 0 <= ret:
      raise errors.InotifyError("Could not add inotify watcher (error code %s);"
                                " increasing fs.inotify.max_user_watches sysctl"
                                " might be necessary" % ret)

    return result[filename]
dataset/ETHPy150Open ganeti/ganeti/lib/asyncnotifier.py/FileEventHandlerBase.AddWatch/swapped operands of `<=`