code: def partition(cls, iterable, pred):
      
  
      t1, t2 = itertools.tee(iterable)
      return cls(itertools.filterfalse(pred, t1), filter(pred, t2))
docs: Use a predicate to partition items into false and true entries.