def _get_entities(self, model_persistence, refs, query_args):
        """
        Returns all the entities for the supplied refs. model_persistence is the persistence
        object that will be used to get to the correct query method and the query_args function
        to return the ref specific query argument.

        This is such a weirdly specific method that it is likely better only in this context.
        """
        q = None
        for ref in refs:
            if not q:
                q = Q(**query_args(ref))
            else:
                q |= Q(**query_args(ref))
        if q:
            return model_persistence._get_impl().model.objects(q)
        return []

        Returns all the entities for the supplied refs. model_persistence is the persistence
        object that will be used to get to the correct query method and the query_args function
        to return the ref specific query argument.

        This is such a weirdly specific method that it is likely better only in this context.
        
st2api/st2api/controllers/v1/rule_views.py