async def say_goodbye(self, peer_id: ID, reason: GoodbyeReasonCode) -> None:
    goodbye = Goodbye(reason)
    self.logger.debug('Opening new stream to peer=%s with protocols=%s', peer_id, [REQ_RESP_GOODBYE_SSZ])
    stream = (await self.host.new_stream(peer_id, [REQ_RESP_GOODBYE_SSZ]))
    self.logger.debug('Sending our goodbye message %s', goodbye)
    try:
        (await write_req(stream, goodbye))
        has_error = False
    except (WriteMessageFailure, MplexStreamEOF, MplexStreamReset) as error:
        has_error = True
        if isinstance(error, WriteMessageFailure):
            (await stream.reset())
        elif isinstance(error, MplexStreamEOF):
            (await stream.close())
    if (not has_error):
        (await stream.close())
    (await self.disconnect_peer(peer_id))
async def say_goodbye(self, peer_id: ID, reason: GoodbyeReasonCode) -> None:
    goodbye = Goodbye(reason)
    self.logger.debug('Opening new stream to peer=%s with protocols=%s', peer_id, [REQ_RESP_GOODBYE_SSZ])
    stream = (await self.host.new_stream(peer_id, [REQ_RESP_GOODBYE_SSZ]))
    self.logger.debug('Sending our goodbye message %s', goodbye)
    try:
        (await write_req(stream, goodbye))
        has_error = False
    except (WriteMessageFailure, MplexStreamEOF, MplexStreamReset) as error:
        has_error = True
        if isinstance(error, WriteMessageFailure):
            (await stream.reset())
        elif isinstance(error, MplexStreamEOF):
            (await stream.close())
    if (not has_error):
        (await stream.close())
    (await self.disconnect_peer(peer_id))