def _annotation_packet(annotations, action):
    """
    Generate a packet suitable for sending down the websocket that represents
    the specified action applied to the passed annotations.
    """
    return {
        'payload': annotations,
        'type': 'annotation-notification',
        'options': {'action': action},
    }