<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, text):
 """Write text in the terminal without breaking the spinner."""

        # similar to tqdm.write()
        # https://pypi.python.org/pypi/tqdm#writing-messages
        sys.stdout.write("\r")
        self._clear_line()

        _text = to_unicode(text)
        if PY2:
            _text = _text.encode(ENCODING)

        # Ensure output is bytes for Py2 and Unicode for Py3
        assert isinstance(_text, builtin_str)

        sys.stdout.write("{0}\n".format(_text))