Given an object and a mongo-style dotted key path, return the
        object value referenced by that key path.

def path_eval(self, obj, keypath):
        '''Given an object and a mongo-style dotted key path, return the
        object value referenced by that key path.
        '''
        segs = keypath.split('.')
        this = obj
        for seg in segs:
            if isinstance(this, dict):
                try:
                    this = this[seg]
                except KeyError:
                    raise self.InvalidPath()
            elif isinstance(this, (list, tuple)):
                if seg.isdigit():
                    this = this[int(seg)]
            else:
                try:
                    this = getattr(this, seg)
                except AttributeError:
                    raise self.InvalidPath()
        return this