code: def end_stream(self, stream_id):
          
          with (yield from self._get_stream(stream_id).wlock):
              yield from self._resumed.wait()
              self._conn.end_stream(stream_id)
              self._flush()
docs: Close the given stream locally.
  
          This may block until the underlying transport becomes writable, or
          other coroutines release the wlock on this stream.
  
          :param stream_id: Which stream to close.