def keys(self):
        """Create an ordered dict of the names and values of key fields."""

        keys = OrderedDict()

        def order_key(_):
            (k, v) = _
            cache_key = getattr(type(self), k)
            return cache_key.order

        items = [(k, getattr(type(self), k)) for k
            in dir(type(self))
        ]
        items = [(k, v) for (k, v)
            in items
            if isinstance(v, Key)
        ]

        for k, v in sorted(items, key=order_key):
            keys[k] = getattr(self, k)
        return keys
def keys ( self ) : keys = OrderedDict ( ) def order_key ( _ ) : ( k , v ) = _ cache_key = getattr ( type ( self ) , k ) return cache_key . order items = [ ( k , getattr ( type ( self ) , k ) ) for k in dir ( type ( self ) ) ] items = [ ( k , v ) for ( k , v ) in items if isinstance ( v , Key ) ] for k , v in sorted ( items , key = order_key ) : keys [ k ] = getattr ( self , k ) return keys
Create an ordered dict of the names and values of key fields.