(row, tag_dict, tags_to_add, datastore, flush_interval)
Tag each event from a dataframe with tags.

    Args:
        row (np.Series): a single row of data with existing tags and
            information about the event in order to be able to add
            tags to it.
        tag_dict (dict): a dict that contains information to be returned
            by the API call to the user.
        tags_to_add (list[str]): a list of strings of tags to add to each
            event.
        datastore (opensearch.OpenSearchDataStore): the datastore object.
        flush_interval (int): the number of events to import before a bulk
            update is done with the datastore.
Tag each event from a dataframe with tags.
Tag each event from a dataframe with tags .
def _tag_event(row, tag_dict, tags_to_add, datastore, flush_interval):
    """Tag each event from a dataframe with tags.

    Args:
        row (np.Series): a single row of data with existing tags and
            information about the event in order to be able to add
            tags to it.
        tag_dict (dict): a dict that contains information to be returned
            by the API call to the user.
        tags_to_add (list[str]): a list of strings of tags to add to each
            event.
        datastore (opensearch.OpenSearchDataStore): the datastore object.
        flush_interval (int): the number of events to import before a bulk
            update is done with the datastore.
    """
    tag_dict['events_processed_by_api'] += 1
    existing_tags = set()

    if 'tag' in row:
        tag = row['tag']
        if isinstance(tag, (list, tuple)):
            existing_tags = set(tag)

        new_tags = list(set().union(existing_tags, set(tags_to_add)))
    else:
        new_tags = tags_to_add

    if set(existing_tags) == set(new_tags):
        return

    datastore.import_event(
        index_name=row['_index'], event_type=row['_type'],
        event_id=row['_id'], event={'tag': new_tags},
        flush_interval=flush_interval)

    tag_dict['tags_applied'] += len(new_tags)
    tag_dict['number_of_events_with_added_tags'] += 1
def _tag_event ( row , tag_dict , tags_to_add , datastore , flush_interval ) : tag_dict [ 'events_processed_by_api' ] += 1 existing_tags = set ( ) if 'tag' in row : tag = row [ 'tag' ] if isinstance ( tag , ( list , tuple ) ) : existing_tags = set ( tag ) new_tags = list ( set ( ) . union ( existing_tags , set ( tags_to_add ) ) ) else : new_tags = tags_to_add if set ( existing_tags ) == set ( new_tags ) : return datastore . import_event ( index_name = row [ '_index' ] , event_type = row [ '_type' ] , event_id = row [ '_id' ] , event = { 'tag' : new_tags } , flush_interval = flush_interval ) tag_dict [ 'tags_applied' ] += len ( new_tags ) tag_dict [ 'number_of_events_with_added_tags' ] += 1