Implementing data structures using python