docs: def _get_writable(stream_or_path, mode):
      """This method returns a tuple containing the stream and a flag to indicate
      if the stream should be automatically closed.
  
      The `stream_or_path` parameter is returned if it is an open writable stream.
      Otherwise, it treats the `stream_or_path` parameter as a file path and
      opens it with the given mode.
  
      It is used by the svg and png methods to interpret the file parameter.
  
      :type stream_or_path: str | io.BufferedIOBase
      :type mode: str | unicode
      :rtype: (io.BufferedIOBase, bool)
      """
      is_stream = hasattr(stream_or_path, 'write')
      if not is_stream:
          # No stream provided, treat "stream_or_path" as path
          stream_or_path = open(stream_or_path, mode)
      return stream_or_path, not is_stream