I'd tweak your code example to this:
def drawHighlightingRectangle(someDecidingFactor1, someDecidingFactor2, x0, y0, x1, y1): def highlight_color(factor1, factor2): if factor1 == something && factor2 != somethingElse: return "red" else: return "blue" color = highlight_color(someDecidingFactor1, someDecidingFactor2) drawRectangle(color, x0, y0, x1, y1)
I'd tweak your code example to this:
This doesn't Repeat the drawRectangle() call.