Finally block always runs in python, avoid returning values in this block
>>> def foo(): ... try: ... return 1 ... except: ... return 2 ... finally: ... return 3 ... >>> foo() 3 >>> def foo(): ... try: ... raise ValueError ... except: ... return 2 ... finally: ... return 3 ... >>> foo() 3