code: def _get_stream(pytube_video, ext, only_progressive, resolution):
      if ext is not None:
          ext = ext[1:]  # remove "."
  
      if only_progressive:
          progressive = True
      else:
          progressive = None
  
      while True:
          streams = pytube_video.streams.filter(
              type="video", progressive=progressive, file_extension=ext
          )
  
          if streams:
              if etau.is_numeric(resolution):
                  all_res = [int(s.resolution[:-1]) for s in streams]
                  idx = _find_nearest(all_res, resolution)
                  return streams[idx]
  
              if resolution == "lowest":
                  return streams.order_by("resolution").first()
  
              return streams.order_by("resolution").desc().first()
  
          if progressive:
              progressive = None
          elif ext is not None:
              if only_progressive and progressive is None:
                  progressive = True
  
              ext = None
          else:
              raise ValueError("No video streams found")
  
imports: import importlib
  import itertools
  import logging
  import multiprocessing.dummy
  import os
  import numpy
  import eta.core.utils
  import eta.core.video
  import fiftyone.core.utils
label_desc: Use image node_id 9 for calling a global function with example usage: _get_stream(pytube_video, ext, only_progressive, resolution) and returns: streams, streams, streams