code: def event_attach(self, eventtype, callback, *args, **kwds):
          
          if not isinstance(eventtype, EventType):
              raise VLCException("%s required: %r" % ('EventType', eventtype))
          if not hasattr(callback, '__call__'):  # callable()
              raise VLCException("%s required: %r" % ('callable', callback))
           # check that the callback expects arguments
          if not any(getargspec(callback)[:2]):  # list(...)
              raise VLCException("%s required: %r" % ('argument', callback))
  
          if self._callback_handler is None:
              _called_from_ctypes = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p)
              @_called_from_ctypes
              def _callback_handler(event, k):
                  """(INTERNAL) handle callback call from ctypes.
  
                  @note: We cannot simply make this an EventManager
                  method since ctypes does not prepend self as the
                  first parameter, hence this closure.
                  """
                  try: # retrieve Python callback and arguments
                      call, args, kwds = self._callbacks[k]
                       # deref event.contents to simplify callback code
                      call(event.contents, *args, **kwds)
                  except KeyError:  # detached?
                      pass
              self._callback_handler = _callback_handler
              self._callbacks = {}
  
          k = eventtype.value
          r = libvlc_event_attach(self, k, self._callback_handler, k)
          if not r:
              self._callbacks[k] = (callback, args, kwds)
          return r
docs: Register an event notification.
  
          @param eventtype: the desired event type to be notified about.
          @param callback: the function to call when the event occurs.
          @param args: optional positional arguments for the callback.
          @param kwds: optional keyword arguments for the callback.
          @return: 0 on success, ENOMEM on error.
  
          @note: The callback function must have at least one argument,
          an Event instance.  Any other, optional positional and keyword
          arguments are in B{addition} to the first one.