def do_something(calculate=None): if calculate is None: # do that return 'Whatever' if calculate == "something expected": # do this return 'Whateverelse'