Separate the underlying buffer from the TextIOBase and return it. After the underlying buffer has been detached, the TextIO is in an unusable state.
io/TextIOBase.detach
TextIOBase.detach