def _change_colours(self, colour, attr, bg):
            # Change attribute first as this will reset colours when swapping
            # modes.
            if attr != self._attr:
                sys.stdout.write(self._a_normal)
                if attr != 0:
                    sys.stdout.write(self._ATTRIBUTES[attr])
                self._attr = attr
                self._colour = None
                self._bg = None

            # Now swap colours if required.
            if colour != self._colour:
                sys.stdout.write(curses.tparm(
                    self._fg_color, colour).decode("utf-8"))
                self._colour = colour
            if bg != self._bg:
                sys.stdout.write(curses.tparm(
                    self._bg_color, bg).decode("utf-8"))
                self._bg = bg
"{u}'abc'" --> "u'abc'" (Python 2)
dataset/ETHPy150Open peterbrittain/asciimatics/asciimatics/screen.py/_CursesScreen._change_colours--crossover with--dataset/ETHPy150Open PythonCharmers/python-future/docs/3rd-party-py3k-compat-code/ipython_py3compat.py/u_format