'Turns filters for a given rypte into a set of query IDs.
This can result in multiple queries due to the nature of the query
processing on the server side. Since multiple values are treated as
an OR condition, a query for {\'id\': (\'1\', \'2\')} is equivalent
to a query for {\'id\': (\'1\',)} and {\'id\': (\'2\')}. This method splits
the former into the latter to ensure we aren\'t asking the server
something we already know.'

def _get_query_ids(self, rtype, filters):

    query_ids = set()
    for (k, values) in tuple(sorted(filters.items())):
        if (len(values) > 1):
            for v in values:
                new_filters = filters.copy()
                new_filters[k] = (v,)
                query_ids.update(self._get_query_ids(rtype, new_filters))
            break
    else:
        query_ids.add(((rtype,) + tuple(sorted(filters.items()))))
    return query_ids
