title: Merge two iter efficiently
body: <p>Need to design a method that takes an huge iter lets assume of size n, an operation min/max/etc is performed on it only for m iterations, finally method has to return output of operation and an copy of the input iter. </p>
  
  <p>n tends to infinite, m tends to postive number less than n.</p>
  
  <pre><code>copy_it =  merge(poped_iter, it)
  </code></pre>
  
  <p>Using itertools.tee an iter could be cloned however internally it will iterate ove the iter, and if iter is huge it will take some n amount of time. I am looking a way to merge two iter without iterating on them.</p>
  
  <pre><code>def some_operation_and_copy_iter(it: iter, m: int) -&gt; (int, iter):
      import itertools
      it, copy_it = itertools.tee(it)
  
      poped_data = []
      # Some operation on it
      max = -1
      i = 0
      while i &lt; m:
          data = next(it)
          poped_data.append(data)
          if data &gt;= max:
              max = data
          i += 1
  
      poped_iter = iter(poped_data)
      # copy_it =  merge(poped_iter, it)
      return max, copy_it
  
  
  max, it = some_operation_and_copy_iter(iter(range(0, 1000000)), 100)
  assert max == 99
  assert list(it) == list(iter(range(0, 1000000)))
  </code></pre>