async def add_event_callback(self, name, namespace, cb, event, **kwargs):
    'Adds a callback for an event which is called internally by apps.\n\n        Args:\n            name (str): Name of the app.\n            namespace  (str): Namespace of the event.\n            cb: Callback function.\n            event (str): Name of the event.\n            **kwargs: List of values to filter on, and additional arguments to pass to the callback.\n\n        Returns:\n            ``None`` or the reference to the callback handle.\n\n        '
    if (self.AD.threading.validate_pin(name, kwargs) is True):
        if ('pin' in kwargs):
            pin_app = kwargs['pin_app']
        else:
            pin_app = self.AD.app_management.objects[name]['pin_app']
        if ('pin_thread' in kwargs):
            pin_thread = kwargs['pin_thread']
            pin_app = True
        else:
            pin_thread = self.AD.app_management.objects[name]['pin_thread']
        async with self.AD.callbacks.callbacks_lock:
            if (name not in self.AD.callbacks.callbacks):
                self.AD.callbacks.callbacks[name] = {}
            handle = uuid.uuid4().hex
            self.AD.callbacks.callbacks[name][handle] = {'name': name, 'id': self.AD.app_management.objects[name]['id'], 'type': 'event', 'function': cb, 'namespace': namespace, 'event': event, 'pin_app': pin_app, 'pin_thread': pin_thread, 'kwargs': kwargs}
        if ('timeout' in kwargs):
            exec_time = ((await self.AD.sched.get_now()) + datetime.timedelta(seconds=int(kwargs['timeout'])))
            kwargs['__timeout'] = (await self.AD.sched.insert_schedule(name, exec_time, None, False, None, __event_handle=handle))
        (await self.AD.state.add_entity('admin', 'event_callback.{}'.format(handle), 'active', {'app': name, 'event_name': event, 'function': cb.__name__, 'pinned': pin_app, 'pinned_thread': pin_thread, 'fired': 0, 'executed': 0, 'kwargs': kwargs}))
        return handle
    else:
        return None
Adds a callback for an event which is called internally by apps.

Args:
    name (str): Name of the app.
    namespace  (str): Namespace of the event.
    cb: Callback function.
    event (str): Name of the event.
    **kwargs: List of values to filter on, and additional arguments to pass to the callback.

Returns:
    ``None`` or the reference to the callback handle.
async def add_event_callback(self, name, namespace, cb, event, **kwargs):
    'Adds a callback for an event which is called internally by apps.\n\n        Args:\n            name (str): Name of the app.\n            namespace  (str): Namespace of the event.\n            cb: Callback function.\n            event (str): Name of the event.\n            **kwargs: List of values to filter on, and additional arguments to pass to the callback.\n\n        Returns:\n            ``None`` or the reference to the callback handle.\n\n        '
    if (self.AD.threading.validate_pin(name, kwargs) is True):
        if ('pin' in kwargs):
            pin_app = kwargs['pin_app']
        else:
            pin_app = self.AD.app_management.objects[name]['pin_app']
        if ('pin_thread' in kwargs):
            pin_thread = kwargs['pin_thread']
            pin_app = True
        else:
            pin_thread = self.AD.app_management.objects[name]['pin_thread']
        async with self.AD.callbacks.callbacks_lock:
            if (name not in self.AD.callbacks.callbacks):
                self.AD.callbacks.callbacks[name] = {}
            handle = uuid.uuid4().hex
            self.AD.callbacks.callbacks[name][handle] = {'name': name, 'id': self.AD.app_management.objects[name]['id'], 'type': 'event', 'function': cb, 'namespace': namespace, 'event': event, 'pin_app': pin_app, 'pin_thread': pin_thread, 'kwargs': kwargs}
        if ('timeout' in kwargs):
            exec_time = ((await self.AD.sched.get_now()) + datetime.timedelta(seconds=int(kwargs['timeout'])))
            kwargs['__timeout'] = (await self.AD.sched.insert_schedule(name, exec_time, None, False, None, __event_handle=handle))
        (await self.AD.state.add_entity('admin', 'event_callback.{}'.format(handle), 'active', {'app': name, 'event_name': event, 'function': cb.__name__, 'pinned': pin_app, 'pinned_thread': pin_thread, 'fired': 0, 'executed': 0, 'kwargs': kwargs}))
        return handle
    else:
        return None