def METHOD_NAME(self):
    def _sort_columns(p):
        if (
            p[2] == "defect"
        ):  # defect -> non-defect is what we plan to autofix, so we show it first in the email.
            prio = 0
        elif (
            p[3] == "defect"
        ):  # non-defect -> defect has more priority than the rest, as 'enhancement' and 'task' can be often confused.
            prio = 1
        else:
            prio = 2
        # Then, we sort by confidence and ID.
        # p[0] is the id and is a string
        return (prio, -p[4], -int(p[0]))
    return _sort_columns