def parse_hal_binned_tags(hal_binned_tags):
    """Parses the tag information from the output of HAL

    Parameters
    ----------
    hal_binned_tags: output of HAL.get_outputs() (list of tuples)

    Returns a nested dictionary:
        [output_id][dimension] = list of (times, count) tuples
    """
    parsed_tags = {}
    for time, output_id, dim, count in hal_binned_tags:
        if output_id not in parsed_tags:
            parsed_tags[output_id] = {}
        if dim not in parsed_tags[output_id]:
            parsed_tags[output_id][dim] = []
        parsed_tags[output_id][dim].append((time, count))
    return parsed_tags