def METHOD_NAME(self, row):
    value = self._elements[row]
    a = value.brushColor().rgba()
    b = value.pmapColor().rgba()
    try:
        # Return a cached icon if we already generated one.
        return CropListModel.icon_cache[(a, b)]
    except KeyError:
        if a == b:
            pixmap = QPixmap(_NPIXELS, _NPIXELS)
            pixmap.fill(value.brushColor())
        else:
            img = QImage(_NPIXELS, _NPIXELS, QImage.Format_RGB32)
            for i in range(_NPIXELS):
                for j in range(0, _NPIXELS - i):
                    img.setPixel(i, j, a)
            for i in range(_NPIXELS):
                for j in range(_NPIXELS - i, _NPIXELS):
                    img.setPixel(i, j, b)
            pixmap = QPixmap.fromImage(img)
        icon = QIcon(pixmap)
        # Cache this icon so we don't have to make it again
        CropListModel.icon_cache[(a, b)] = icon
        return icon