Python Reverse Dictionary Order Topology Math