def indices_to_md5s(prototype_clusters: list, prototypes_to_data_points: dict, md5s: list) -> tuple:
    """
    Groups clusters together using their original md5s
    Parameters
    ----------
    prototype_clusters: list
        List of lists representing clustered prototypes
    prototypes_to_data_points: dict
        Dict mapping from each prototype to the data points within their cluster
    md5s: list
        List of all md5s

    Returns
    -------
    (List, List)
        A list of lists where each inner list contains md5s representing a cluster
        A list of lists where each inner lists contains md5s representing prototypes within a cluster
    """
    md5_clusters = list()
    current_cluster = list()

    md5_prototype_clusters = list()
    current_prototype_cluster = list()

    # Convert clusters from indices to md5s
    for cluster in prototype_clusters:
        for prototype in cluster:
            current_cluster.append(md5s[prototype])
            current_prototype_cluster.append(md5s[prototype])

            for data_point in prototypes_to_data_points[prototype]:
                current_cluster.append(md5s[data_point])

        md5_clusters.append(current_cluster.copy())
        current_cluster.clear()

        md5_prototype_clusters.append(current_prototype_cluster.copy())
        current_prototype_cluster.clear()

    return md5_clusters, md5_prototype_clusters