def invertbgcolor(self, region=None):
        regionx, regiony, regionwidth, regionheight = self.getregion(region)
        if (regionx, regiony, regionwidth, regionheight) == (None, None, None, None):
            return

        for ix in range(regionx, regionx + regionwidth):
            for iy in range(regiony, regiony + regionheight):
                self._invertbg(ix, iy)
                self._screendirty[ix][iy] = True
        if self._autoupdate:
            self.update()
Performs retries on connection refused errors (for travis-ci builds)
dataset/ETHPy150Open asweigart/pygcurse/pygcurse/__init__.py/PygcurseSurface.invertbgcolor--crossover with--dataset/ETHPy150Open vmalloc/mongomock/tests/test__mongomock.py/_CollectionComparisonTest._connect_to_local_mongodb