def METHOD_NAME(self, event, msg):
    for endpoint in self.endpoints:
        if not msg or msg['plugin'] in ['*', endpoint.plugin]:
            data = msg['data'] if msg else None
            try:
                getattr(endpoint, f'on_{event}')(data)
            # pylint: disable=W0703
            except Exception:
                logging.error('Exception in socket event handler')
                traceback.print_exc()