Stack implementation in python