def get_row_group_indexes(dataset):
    """
    Extract and return row group indexes from dataset
    :param dataset: dataset object
    :return: dataset indexes as dictionary
    """
    if not dataset.common_metadata:
        raise ValueError('Could not find _metadata file. add_dataset_metadata(..) in'
                         ' petastorm.etl.dataset_metadata.py should be used to'
                         ' generate this file in your ETL code.'
                         ' You can generate it on an existing dataset using rowgroup_indexing_run.py')

    dataset_metadata_dict = dataset.common_metadata.metadata

    # Load rowgroups_index
    if ROWGROUPS_INDEX_KEY not in dataset_metadata_dict:
        raise ValueError('Row groups index is not available in the dataset metadata file. '
                         'You can generate it on an existing dataset using rowgroup_indexing_run.py')

    serialized_indexes = dataset_metadata_dict[ROWGROUPS_INDEX_KEY]

    index_dict = depickle_legacy_package_name_compatible(serialized_indexes)
    return index_dict

    Extract and return row group indexes from dataset
    :param dataset: dataset object
    :return: dataset indexes as dictionary
    
petastorm/etl/rowgroup_indexing.py