python error unboundlocalerror local variable referenced before assignment