def oo_select_keys(data, keys):
 if (not isinstance(data, Mapping)):
  raise errors.AnsibleFilterError('|failed expects to filter on a dict or object')
 if (not isinstance(keys, list)):
  raise errors.AnsibleFilterError('|failed expects first param is a list')
 retval = [data[key] for key in keys if (key in data)]
 return retval

def oo_select_keys ( data , keys ) : if ( not isinstance ( data , Mapping ) ) : raise errors . AnsibleFilterError ( '|failed expects to filter on a dict or object' ) if ( not isinstance ( keys , list ) ) : raise errors . AnsibleFilterError ( '|failed expects first param is a list' ) retval = [ data [ key ] for key in keys if ( key in data ) ] return retval
this returns a list .