python global referenced before assignment