Python Unboundlocalerror Cannot Access Local Variable Results