code: def observe_with(observer, event_handler, pathnames, recursive):
      """
      Single observer thread with a scheduled path and event handler.
  
      :param observer:
          The observer thread.
      :param event_handler:
          Event handler which will be called in response to file system events.
      :param pathnames:
          A list of pathnames to monitor.
      :param recursive:
          ``True`` if recursive; ``False`` otherwise.
      """
      for pathname in set(pathnames):
          observer.schedule(event_handler, pathname, recursive)
      observer.start()
      try:
          while True:
              time.sleep(1)
      except KeyboardInterrupt:
          observer.stop()
      observer.join()
  
file_path: wandb/wandb/vendor/watchdog_0_9_0/wandb_watchdog/watchmedo.py
imports: import os.path
  import sys
  import yaml
  import time
  import logging
  from argh import arg, aliases, ArghParser, expects_obj
  from wandb_watchdog.version import VERSION_STRING
  from wandb_watchdog.utils import load_class
label_desc: Use image node_id 5 for calling a global function with example usage: observe_with(observer, event_handler, pathnames, recursive) without return types