@memoized
    def getColor2(value, default=None):
        """
        Convert to color value.
        This returns a Color object instance from a text bit.
        """

        if isinstance(value, Color):
            return value
        value = str(value).strip().lower()
        if value == "transparent" or value == "none":
            return default
        if COLOR_BY_NAME in value:
            return COLOR_BY_NAME[value]
        if value.startswith("#") and len(value) == 4:
            value = "#" + value[1] + value[1] + value[2] + value[2] + value[3] + value[3]
        elif rgb_re.search(value):
            # e.g., value = "<css function: rgb(153, 51, 153)>", go figure:
            r, g, b = [int(x) for x in rgb_re.search(value).groups()]
            value = "#%02x%02x%02x" % (r, g, b)
        else:
            # Shrug
            pass
        return toColor(value, default) # Calling the reportlab function

    #import xhtml2pdf.util
    #xhtml2pdf.util.getColor = getColor2
dataset/ETHPy150Open rst2pdf/rst2pdf/rst2pdf/utils.py/getColor2/swapped operands of `in`