def _cleanup(lst):
    '''
    Return a list of non-empty dictionaries.
    '''
    clean = []
    for ele in lst:
        if ele and isinstance(ele, dict):
            clean.append(ele)
    return clean
def _cleanup ( lst ) : clean = [ ] for ele in lst : if ele and isinstance ( ele , dict ) : clean . append ( ele ) return clean
Return a list of non-empty dictionaries.