code: def _get_stream_length(stream):
      # type: (IO[AnyStr]) -> int
      current_position = stream.tell()
      # seek to end of file
      stream.seek(0, 2)
      total_length = stream.tell()
      # seek back to current position to support
      # partially read file-like objects
      stream.seek(current_position or 0)
      return total_length
  
imports: import logging
  import os
  from time import time
  from typing import Optional, AnyStr, IO
  from ..config import config
label_desc: Use image node_id 5 for calling the UploadProgressReport obj's underlying member method code with example usage: obj._get_stream_length(stream) and returns: total_length