def firstValid(*args, default): for arg in args: if arg is not None: return arg return default