code: def copy_byte_range(
      infile, outfile, start=None, stop=None, bufsize=16 * 1024
  ):
      """Like shutil.copyfileobj, but only copy a range of the streams.
  
      Both start and stop are inclusive.
      """
      if start is not None:
          infile.seek(start)
      while 1:
          to_read = min(
              bufsize, stop + 1 - infile.tell() if stop else bufsize
          )
          buf = infile.read(to_read)
          if not buf:
              break
          outfile.write(buf)
  
file_path: rasterio/tests/rangehttpserver.py
imports: import os
  import re
label_desc: Use image node_id 1 for calling a global function with example usage: copy_byte_range(infile, outfile, start, stop, bufsize) without return types