Python data structures with two-way data transformations