code: def _prepare_sets(self, sets):
          
  
          final_sets = set()
          tmp_keys = set()
  
          for set_ in sets:
              if isinstance(set_, str):
                  final_sets.add(set_)
              elif isinstance(set_, ParsedFilter):
  
                  for index_key, key_type, is_tmp in set_.index.get_filtered_keys(
                              set_.suffix,
                              accepted_key_types=self._accepted_key_types,
                              *(set_.extra_field_parts + [set_.value])
                          ):
                      if key_type not in self._accepted_key_types:
                          raise ValueError('The index key returned by the index %s is not valid' % (
                              set_.index.__class__.__name__
                          ))
                      final_sets.add(index_key)
                      if is_tmp:
                          tmp_keys.add(index_key)
              else:
                  raise ValueError('Invalid filter type')
  
          return final_sets, tmp_keys
docs: Return all sets in self._lazy_collection['sets'] to be ready to be used
          to intersect them. Called by _get_final_set, to use in subclasses.
          Must return a tuple with a set of redis set keys, and another with
          new temporary keys to drop at the end of _get_final_set