/**
 * This function takes a nested list of species data and a list of desired species as input.
 * It returns a new nested list that includes only the data for the desired species.
 *
 * @param data a nested list containing species data, where each sublist represents data for a particular species.
 * @param species a list of species for which the data needs to be retrieved.
 * @return A new nested list containing data only for the desired species.
 *
 * Examples:
 * data = [['SpeciesA', 10, 20, 30], ['SpeciesB', 15, 25, 35], ['SpeciesC', 12, 23, 34]]
 * species = ['SpeciesA', 'SpeciesC']
 * retrieveSpeciesData(data, species) -> [['SpeciesA', 10, 20, 30], ['SpeciesC', 12, 23, 34]]
 */
fun retrieveSpeciesData(data: List<List<Any>>, species: List<String>): List<List<Any>> {

    val selectedSpeciesData = mutableListOf<List<Any>>()
    
    for (sublist in data) {
        if (sublist[0] in species) {
            selectedSpeciesData.add(sublist)
        }
    }
    
    return selectedSpeciesData
}
/**
 * This function takes a nested list of species data and a list of desired species as input.
 * It returns a new nested list that includes only the data for the desired species.
 *
 * @param data a nested list containing species data, where each sublist represents data for a particular species.
 * @param species a list of species for which the data needs to be retrieved.
 * @return A new nested list containing data only for the desired species.
 *
 * Examples:
 * data = [['SpeciesA', 10, 20, 30], ['SpeciesB', 15, 25, 35], ['SpeciesC', 12, 23, 34]]
 * species = ['SpeciesA', 'SpeciesC']
 * retrieveSpeciesData(data, species) -> [['SpeciesA', 10, 20, 30], ['SpeciesC', 12, 23, 34]]
 */
fun retrieveSpeciesData(data: List<List<Any>>, species: List<String>): List<List<Any>> {
/**
 * This function takes a nested list of species data and a list of desired species as input.
 * It returns a new nested list that includes only the data for the desired species.
 *
 * @param data a nested list containing species data, where each sublist represents data for a particular species.
 * @param species a list of species for which the data needs to be retrieved.
 * @return A new nested list containing data only for the desired species.
 *
 * Examples:
 * data = [['SpeciesA', 10, 20, 30], ['SpeciesB', 15, 25, 35], ['SpeciesC', 12, 23, 34]]
 * species = ['SpeciesA', 'SpeciesC']
 * retrieveSpeciesData(data, species) -> [['SpeciesA', 10, 20, 30], ['SpeciesC', 12, 23, 34]]
 */
fun retrieveSpeciesData(data: List<List<Any>>, species: List<String>): List<List<Any>> {

    val selectedSpeciesData = mutableListOf<List<Any>>()
    
    for (sublist in data) {
        if (sublist[0] in species) {
            selectedSpeciesData.add(sublist)
        }
    }
    
    return selectedSpeciesData
}