FYI, there is at least one library that provides bidirectional dicts: bidict. Github page: https://github.com/jab/bidict