Shorten the if-elif-else statement in regression.py file