implementing data structures in python