code: def _stop_on_read(fd):
      """Register callback to stop eventloop when there's data on fd"""
      fdref = CFFileDescriptorCreate(
          None, fd, False, _c_input_callback, None
      )
      CFFileDescriptorEnableCallBacks(
          fdref, kCFFileDescriptorReadCallBack
      )
      source = CFFileDescriptorCreateRunLoopSource(None, fdref, 0)
      loop = CFRunLoopGetCurrent()
      CFRunLoopAddSource(loop, source, kCFRunLoopCommonModes)
      CFRelease(source)
  
file_path: catboost/contrib/python/ipython/py3/IPython/terminal/pt_inputhooks/osx.py
imports: import ctypes
  import ctypes.util
  from threading import Event
label_desc: Use image node_id 7 for calling a global function with example usage: _stop_on_read(fd) without return types