def parse_response(service, response, search_type):
    """Parse the response to a music service query and return a SearchResult

    Args:
        service (MusicService): The music service that produced the response
        response (OrderedDict): The response from the soap client call
        search_type (str): A string that indicates the search type that the
            response is from

    Returns:
        SearchResult: A SearchResult object
    """
    _LOG.debug('Parse response "%s" from service "%s" of type "%s"', response,
               service, search_type)
    items = []
    # The result to be parsed is in either searchResult or getMetadataResult
    if 'searchResult' in response:
        response = response['searchResult']
    elif 'getMetadataResult' in response:
        response = response['getMetadataResult']
    else:
        raise ValueError('"response" should contain either the key '
                         '"searchResult" or "getMetadataResult"')

    # Form the search metadata
    search_metadata = {
        'number_returned': response['count'],
        'total_matches': None,
        'search_type': search_type,
        'update_id': None,
    }

    for result_type in ('mediaCollection', 'mediaMetadata'):
        # Upper case the first letter (used for the class_key)
        result_type_proper = result_type[0].upper() + result_type[1:]
        raw_items = response.get(result_type, [])
        # If there is only 1 result, it is not put in an array
        if isinstance(raw_items, OrderedDict):
            raw_items = [raw_items]

        for raw_item in raw_items:
            # Form the class_key, which is a unique string for this type,
            # formed by concatenating the result type with the item type. Turns
            # into e.g: MediaMetadataTrack
            class_key = result_type_proper + raw_item['itemType'].title()
            cls = get_class(class_key)
            items.append(cls.from_music_service(service, raw_item))
    return SearchResult(items, **search_metadata)
Parse the response to a music service query and return a SearchResult

    Args:
        service (MusicService): The music service that produced the response
        response (OrderedDict): The response from the soap client call
        search_type (str): A string that indicates the search type that the
            response is from

    Returns:
        SearchResult: A SearchResult object