def error(self, buf, newline=True):
        """ Similar to `write`, except it writes buffer to error stream.
            If coloring enabled, adds error coloring.

            `buf`
                Data buffer to write.
            `newline`
                Append newline character to buffer before writing.
            """

        buf = buf or ''

        if self._colored:
            buf = self.ESCAPE_RED + buf + self.ESCAPE_CLEAR
        if newline:
            buf += os.linesep

        try:
            self._error.write(buf)

            if hasattr(self._error, 'flush'):
                self._error.flush()

        except IOError as exc:
            if exc.errno != errno.EPIPE:  # silence EPIPE errors
                raise
Similar to `write`, except it writes buffer to error stream.
            If coloring enabled, adds error coloring.

            `buf`
                Data buffer to write.
            `newline`
                Append newline character to buffer before writing.