from typing import OrderedDict


def get_profile(line, listOfFeatures):
    """
        Returns a tuple of feature values for the profile in question.
        line is a string that contains key:value pairs separated by whitespace.
        Each key is a feature and each value is its value.
        profile is a list of features (keys).
    """
    
    # Convert line to a dictionary using the key:value pairs
    items = line.strip().split()[1:]
    lineDict = OrderedDict([(item.split(':')[0],item.split(':')[1])
                     for item in items])
    
    # lineProfileList will be populated with feature values
    # only print out those feature values that are part of the subset
    # requested, specified in profileDict[profile]
    lineProfileList = []
    
    for key in listOfFeatures:
        lineProfileList.append(lineDict[key])

    # We must typecast the list of requested feature values
    # as a tuple since lists are not hashable,
    # and we want to count the number of times a given
    # list of values occurs in our examples.
    return tuple(lineProfileList)