code: def register_callback(callback, event_source, event_type):
      
      global _callbacks
      event_interface = type_to_interface(event_type)
      listener = event_source.create_listener()
      event_source.register_listener(listener, [event_type], False)
      quit = threading.Event()
      t = threading.Thread(target=_event_monitor, args=(callback,
                                                        event_source,
                                                        listener,
                                                        event_interface,
                                                        quit))
      t.daemon = True
      t.start()
      while t.is_alive() is False:
          continue
      _callbacks[t.ident] = (t, quit)
      return t.ident
docs: register a callback function against an event_source for a given
      event_type.
  
      Arguments:
          callback - function to call when the event occurs
          event_source - the source to monitor events in
          event_type - the type of event we're monitoring for
  
      returns the registration id (callback_id)