Fix if statement to be more Pythonic

Signed-off-by: Pekka Enberg <penberg@iki.fi>