code: def _write_bytes(stream: Union[StdSim, TextIO], to_write: bytes) -> None:
          
          try:
              stream.buffer.write(to_write)
          except BrokenPipeError:
              # This occurs if output is being piped to a process that closed
              pass
docs: Write bytes to a stream
          :param stream: the stream being written to
          :param to_write: the bytes being written