def run_clustering(clustering, save_path, save_cluster_index, save_centroid_index, save_centroid_poses,
                   save_cluster_poses=True):
    """
    It runs the clustering given a initialized clustering object and returns the same object fitted. When specified, it
    also can save dicts of index/poses ids of each poses for each cluster and dicts of index/poses ids of the centroids
    for each cluster in yaml files.
    Parameters
    ----------
    clustering : Clustering object
        Initialized clustering object.
    save_path : str
        Path to folder where the yaml files will be saved when specified.
    save_cluster_index : bool
        If True, it saves a dict of the poses index that belong to each cluster.
    save_centroid_index : bool
        If True, it saves a yaml file of the pose index of each cluster centroid.
    save_centroid_poses : bool
        If True, it saves a yaml file of the poses ids of each cluster centroid.
    save_cluster_poses : bool
        If True, it saves a dict of the poses ids that belong to each cluster.

    Returns
    -------
    Clustering object fitted.
    """
    clustering.run(save_index_dict=save_cluster_index, save_poses_dict=save_cluster_poses,
                   save_centroid_poses=save_centroid_poses, save_centroid_index=save_centroid_index,
                   save_path=save_path)
    return clustering