

def _get_stream_by_id(self, stream_id):
    '\n        Gets a stream by its stream ID. Raises NoSuchStreamError if the stream\n        ID does not correspond to a known stream and is higher than the current\n        maximum: raises if it is lower than the current maximum.\n\n        .. versionchanged:: 2.0.0\n           Removed this function from the public API.\n        '
    try:
        return self.streams[stream_id]
    except KeyError:
        outbound = self._stream_id_is_outbound(stream_id)
        highest_stream_id = (self.highest_outbound_stream_id if outbound else self.highest_inbound_stream_id)
        if (stream_id > highest_stream_id):
            raise NoSuchStreamError(stream_id)
        else:
            raise StreamClosedError(stream_id)

dataset/ETHPy150Open python-hyper/hyper-h2/h2/connection.py H2Connection._get_stream_by_id/original