def _get_non_empty_list ( cls , iter ) : res = [ ] for value in iter : if hasattr ( value , 'items' ) : value = cls . _get_non_empty_dict ( value ) or None if value is not None : res . append ( value ) return res
python none type object not iterable
Return a list of the input excluding all None values .
def _get_non_empty_list(cls, iter):
        """Return a list of the input, excluding all ``None`` values."""
        res = []
        for value in iter:
            if hasattr(value, 'items'):
                value = cls._get_non_empty_dict(value) or None
            if value is not None:
                res.append(value)
        return res