def METHOD_NAME(self, b):
    """
    Trying to prevent a write operation
    on an already closed websocket stream.
    This cannot be bullet proof but hopefully
    will catch almost all use cases.
    """
    if self.terminated:
        raise RuntimeError("Cannot send on a terminated websocket")
    self.io.write(b)