'Get objects based on having a certain Attribute defined.
Args:
attribute_name (str): Attribute name to search for.
candidates (list, optional): Only match among the given list of candidates.
Returns:
matches (list):  All objects having the given attribute_name defined at all.'

@returns_typeclass_list
def get_objs_with_attr(self, attribute_name, candidates=None):

    cand_restriction = (((candidates is not None) and Q(db_attributes__db_obj__pk__in=[_GA(obj, 'id') for obj in make_iter(candidates) if obj])) or Q())
    return list(self.filter((cand_restriction & Q(db_attributes__db_key=attribute_name))))
