def checker(tree, spec, priority=0):
    """A decorator to install a check function:

        @check(tree, "foo/bar")
        def my_check():
            ...

    will install my_check as a check under "foo" called "bar" in tree.
    Optionally privide the priority as the third argument (default is
    0).

    """
    assert "/" in spec
    (path, name) = spec.split("/")
    return lambda f: tree.add(path, priority, name, f)