Find an dictionary in a list of dictionaries, given its main key.

def _lookup_element(lst, key):
    '''
    Find an dictionary in a list of dictionaries, given its main key.
    '''
    if not lst:
        return {}
    for ele in lst:
        if not ele or not isinstance(ele, dict):
            continue
        if ele.keys()[0] == key:
            return ele.values()[0]
    return {}