Ternary-if Converter
Python 2, 126 121 120 114 100 bytes



lambda s:findall(' (.=)',s)[0]+sub('if.(.*?)\)(.=)?',r'\1?',sub('.{5} (.=)?',':',s))
from re import*


Try it online!



Saved:


-1 byte, thanks to Kevin Cruijssen