def METHOD_NAME(type_, preference):
    items = {}
    for item in playlist.findall('./info/%s/item' % type_):
        lang, label = xpath_text(item, 'lg', default=None), xpath_text(item, 'label', default=None)
        if lang and label:
            items[lang] = label.strip()
    for p in preference:
        if items.get(p):
            return items[p]