def write_segment()

in distill/segmentation/segment.py [0:0]


def write_segment(target_dict, segment_names, start_end_vals):
    """
    Creates a nested dictionary of segment names to UIDs which then map to individual
    logs (i.e result['segment_name'][uid] --> log).  This assists with easy iteration over
    defined segments.
        
    :param target_dict: A dictionary of User Ale logs assumed to be ordered by clientTime (Date/Time Objects or integers).
    :param segment_names: A list of segment_names ordered in the same way as the start_end_vals.
    :param start_end_vals: A list of tuples (i.e [(start_time, end_time)]), where start_time and end_time are Date/Time Objects or integers.
        
    :return: A nested dictionary of segment_names to uids to individual logs.
    """
    result = {}
    create_result = create_segment(target_dict, segment_names, start_end_vals)

    # Iterate through segments to get logs
    for segment in create_result:
        result[segment.get_segment_name()] = {}
        for uid in segment.uids:
            result[segment.get_segment_name()][uid] = target_dict[uid]

    return result