def handle_annotation_event(message, socket):
    action = message['action']
    annotation = storage.annotation_from_dict(message['annotation'])

    if action == 'read':
        return None

    if message['src_client_id'] == socket.client_id:
        return None

    if annotation.get('nipsa') and (
            socket.request.authenticated_userid != annotation.get('user', '')):
        return None

    if not _authorized_to_read(socket.request, annotation):
        return None

    # We don't send anything until we have received a filter from the client
    if socket.filter is None:
        return None

    if not socket.filter.match(annotation, action):
        return None

    return {
        'payload': [annotation],
        'type': 'annotation-notification',
        'options': {'action': action},
    }
Get message about annotation event `message` to be sent to `socket`.
dataset/ETHPy150Open hypothesis/h/h/streamer/messages.py/handle_annotation_event