a* implementation in python 2.7