'Return the most-specific value for key along path, or default.'

def find_config(self, path, key, default=None):

    trail = (path or '/')
    while trail:
        nodeconf = self.config.get(trail, {})
        if (key in nodeconf):
            return nodeconf[key]
        lastslash = trail.rfind('/')
        if (lastslash == (-1)):
            break
        elif ((lastslash == 0) and (trail != '/')):
            trail = '/'
        else:
            trail = trail[:lastslash]
    return default
