def METHOD_NAME(self) -> None:
    r, w = os.pipe()
    # Save a copy of the original stream file descriptor.
    original_fd = self._stream.fileno()
    original_fd_copy = os.dup(original_fd)
    # Overwrite the original file descriptor with the write end of the
    # pipe.
    os.dup2(w, original_fd)
    # Create a writeable file object with the original FD. This can be used
    # to write to the original destination of the passed stream.
    self._original_fp = os.fdopen(original_fd_copy, "w")
    # Create a readable file object with the read end of the pipe. This can
    # be used to read any writes to the passed stream.
    #
    # We set the FD to be non-blocking so that we can select/poll/epoll
    # over multiple wrapped streams.
    os.set_blocking(r, False)
    self._wrapped_fp = os.fdopen(r, "r")