code: def loop(self, callback=None, daemonize=False, **args):
          
          if daemonize:
              self.__daemonize(**args)
  
          # Read and process events forever
          while 1:
              try:
                  self.process_events()
                  if (callback is not None) and (callback(self) is True):
                      break
                  ref_time = time.time()
                  # check_events is blocking
                  if self.check_events():
                      self._sleep(ref_time)
                      self.read_events()
              except KeyboardInterrupt:
                  # Stop monitoring if sigint is caught (Control-C).
                  log.debug('Pyinotify stops monitoring.')
                  break
          # Close internals
          self.stop()
docs: Events are read only one time every min(read_freq, timeout)
          seconds at best and only if the size to read is >= threshold.
          After this method returns it must not be called again for the same
          instance.
  
          @param callback: Functor called after each event processing iteration.
                           Expects to receive the notifier object (self) as first
                           parameter. If this function returns True the loop is
                           immediately terminated otherwise the loop method keeps
                           looping.
          @type callback: callable object or function
          @param daemonize: This thread is daemonized if set to True.
          @type daemonize: boolean
          @param args: Optional and relevant only if daemonize is True. Remaining
                       keyworded arguments are directly passed to daemonize see
                       __daemonize() method. If pid_file=None or is set to a
                       pathname the caller must ensure the file does not exist
                       before this method is called otherwise an exception
                       pyinotify.NotifierError will be raised. If pid_file=False
                       it is still daemonized but the pid is not written in any
                       file.
          @type args: various