def case_insensitive_list_match(query, l):
    """
    Returns the first case-insensitive matching item to the query
    """
    query = query.lower()
    l_low = [x.lower() for x in l]
    for (i,x) in enumerate(l_low):
        if query == x:
            return l[i]
    return None