def clean_dict(data_dict):
 for (key, value) in data_dict.items():
  if (not isinstance(value, list)):
   continue
  for inner_dict in value[:]:
   if isinstance(inner_dict, basestring):
    break
   if (not any(inner_dict.values())):
    value.remove(inner_dict)
   else:
    clean_dict(inner_dict)
 return data_dict

def clean_dict ( data_dict ) : for ( key , value ) in data_dict . items ( ) : if ( not isinstance ( value , list ) ) : continue for inner_dict in value [ : ] : if isinstance ( inner_dict , basestring ) : break if ( not any ( inner_dict . values ( ) ) ) : value . remove ( inner_dict ) else : clean_dict ( inner_dict ) return data_dict
takes a dict and if any of the values are lists of dicts .