def _receive_frame(self, frame):
        try:
            # I don't love using __class__ here, maybe reconsider it.
            frames, events = self._frame_dispatch_table[frame.__class__](frame)
        except StreamClosedError as e:
            # We need to send a RST_STREAM frame on behalf of the stream.
            # The frame the stream wants to emit is already present in the
            # exception.
            # This does not require re-raising: it's an expected behaviour. The
            # only time we don't do that is if this is a stream the user
            # manually reset.
            if frame.stream_id not in self._reset_streams:
                f = RstStreamFrame(e.stream_id)
                f.error_code = e.error_code
                self._prepare_for_sending([f])
                events = e._events
            else:
                events = []
        except StreamIDTooLowError as e:
            # The stream ID seems invalid. This is unlikely, so it's probably
            # the case that this frame is actually for a stream that we've
            # already reset and removed the state for. If it is, just swallow
            # the error. If we didn't do that, re-raise.
            if frame.stream_id not in self._reset_streams:
                raise
            events = []
        except KeyError as e:  # pragma: no cover
            # We don't have a function for handling this frame. Let's call this
            # a PROTOCOL_ERROR and exit.
            raise UnsupportedFrameError("Unexpected frame: %s" % frame)
        else:
            self._prepare_for_sending(frames)

        return events
Handle a frame received on the connection.
dataset/ETHPy150Open python-hyper/hyper-h2/h2/connection.py/H2Connection._receive_frame