Python implementation of Push