code: def decode_file_iter(file_obj, codec_options=DEFAULT_CODEC_OPTIONS):
      
      while True:
          # Read size of next object.
          size_data = file_obj.read(4)
          if len(size_data) == 0:
              break  # Finished with file normaly.
          elif len(size_data) != 4:
              raise InvalidBSON("cut off in middle of objsize")
          obj_size = _UNPACK_INT(size_data)[0] - 4
          elements = size_data + file_obj.read(obj_size)
          yield _bson_to_dict(elements, codec_options)
docs: Decode bson data from a file to multiple documents as a generator.
  
      Works similarly to the decode_all function, but reads from the file object
      in chunks and parses bson in chunks, yielding one document at a time.
  
      :Parameters:
        - `file_obj`: A file object containing BSON data.
        - `codec_options` (optional): An instance of
          :class:`~bson.codec_options.CodecOptions`.
  
      .. versionchanged:: 3.0
         Replaced `as_class`, `tz_aware`, and `uuid_subtype` options with
         `codec_options`.
  
      .. versionadded:: 2.8