code: def _pooled_next(iterator: Iterator[Any], pool: Deque[Any]):
      if not pool:
          pool.extend(next(iterator))
      return pool.popleft()
  
imports: import random
  from collections import deque
  from typing import Any, Collection, Deque, Iterable, Iterator, List, Sequence
label_desc: Use image node_id 1 for calling a global function with example usage: _pooled_next(iterator, pool) and returns: pool