code: def from_stream(klass, stream, header, path=None, use_bgzf=None):
          
          if use_bgzf or (use_bgzf is None and path and path.endswith(".gz")):
              stream = bgzf.BgzfWriter(fileobj=stream)
          return Writer(stream, header, path)
docs: Create new :py:class:`Writer` from file
  
          Note that for getting bgzf support, you have to pass in a stream
          opened in binary mode.  Further, you either have to provide a ``path``
          ending in ``".gz"`` or set ``use_bgzf=True``.  Otherwise, you will
          get the notorious "TypeError: 'str' does not support the buffer
          interface".
  
          :param stream: ``file``-like object to write to
          :param header: VCF header to use, lines and samples are deep-copied
          :param path: optional string with path to store (for display only)
          :param use_bgzf: indicator whether to write bgzf to ``stream``
              if ``True``, prevent if ``False``, interpret ``path`` if ``None``