def union_iwp_label( iwp_label_a, iwp_label_b ):
    """
    Creates a new IWP label whose bounding box is the union of two IWP labels.
    The newly created label has the same metadata from the first label and
    a bounding box that minimally spans both labels' bounding boxes.

    Takes 2 arguments:

      iwp_label_a - First IWP label to union.
      iwp_label_b - Second IWP label to union.

    Returns 1 value:

      unioned_iwp_label - Unioned IWP label.

    """

    unioned_iwp_label = {
        "id":              iwp_label_a["id"],
        "category":        iwp_label_a["category"],
        "time_step_index": iwp_label_a["time_step_index"],
        "z_index":         iwp_label_a["z_index"],
        "bbox":            {
            "x1": min( iwp_label_a["bbox"]["x1"], iwp_label_b["bbox"]["x1"] ),
            "x2": max( iwp_label_a["bbox"]["x2"], iwp_label_b["bbox"]["x2"] ),
            "y1": min( iwp_label_a["bbox"]["y1"], iwp_label_b["bbox"]["y1"] ),
            "y2": max( iwp_label_a["bbox"]["y2"], iwp_label_b["bbox"]["y2"] )
        }
    }

    return unioned_iwp_label