def firstStringInList(literalEntities, prefLanguage='en'):
    """
    from a list of literals, returns the one in prefLanguage
    if no language specification is available, return first element
    """
    match = ''
    if len(literalEntities) == 1:
        match = literalEntities[0]
    elif len(literalEntities) > 1:
        for x in literalEntities:
            if getattr(x, 'language') and getattr(x, 'language'
                ) == prefLanguage:
                match = x
        if not match:
            match = literalEntities[0]
    return match
