def oo_filter_list(data, filter_attr=None):
 if (not isinstance(data, list)):
  raise errors.AnsibleFilterError('|failed expects to filter on a list')
 if (not isinstance(filter_attr, string_types)):
  raise errors.AnsibleFilterError('|failed expects filter_attr is a str or unicode')
 return [x for x in data if ((filter_attr in x) and x[filter_attr])]

def oo_filter_list ( data , filter_attr = None ) : if ( not isinstance ( data , list ) ) : raise errors . AnsibleFilterError ( '|failed expects to filter on a list' ) if ( not isinstance ( filter_attr , string_types ) ) : raise errors . AnsibleFilterError ( '|failed expects filter_attr is a str or unicode' ) return [ x for x in data if ( ( filter_attr in x ) and x [ filter_attr ] ) ]
this returns a list .