code: def remote_iterator(view, name):
      """Return an iterator on an object living on a remote engine."""
      view.execute(f"it{name}=iter({name})", block=True)
      while True:
          try:
              result = view.apply_sync(next, ipp.Reference("it" + name))
          # This causes the StopIteration exception to be raised.
          except RemoteError as e:
              if e.ename == "StopIteration":
                  raise StopIteration
              else:
                  raise e
          else:
              yield result
  
imports: import heapq
  import ipyparallel
  from ipyparallel.error import RemoteError
label_desc: Use image node_id 2 for calling a global function with example usage: remote_iterator(view, name) without return types