def cluster_contour_mask(rgb_img, clusters_i, contours, hierarchies):
    """Outputs masks for the grouped clusters. Since there can be a variable number of
    clusters/masks the output is a list of arrays.

    Inputs:
    rgb_img       = RGB image data
    clusters_i    = clusters, output from cluster_contours function
    contours      = contours, contours from cluster_contours function
    hierarchies   = hierarchies, hierarchies from cluster_contours function

    Returns:
    output_masks  = resulting masks
    masked_images  = masked_images

    :param rgb_img: numpy.ndarray
    :param clusters_i: numpy array
    :param contours: numpy array
    :param hierarchies: numpy array
    :return output_masks: list of resulting masks
    :return masked_images: list of masked images
    """
