def find_declare_doc(self, d, name):
        """Given a name, try to resolve the name to a path or URL to
        a declaration document. It will try:

         * The name as a filesystem path
         * The name as a file name in the directory d
         * The name + '.csv' as a name in the directory d
         * The name as a URL
         * The name as a key in the standard_declares dict
         * The name as a path in this module's metatab.declarations package

        """

        path = None
        while True:
            if exists(name):
                path =name
                break

            try:
                # Look for a local document
                path = declaration_path(name)
                break
            except IncludeError:
                pass

            for fn in (join(d, name), join(d, name + '.csv')):
                if exists(fn):
                    path = fn
                    break
            if path:
                break

            if name.startswith('http'):
                path = name.strip('/')  # Look for the file on the web
                break
            elif exists(name):
                path = name
                break
            else:
                path = self.resolver.find_decl_doc(name)
                break

            raise IncludeError("No local declaration file for '{}'".format(name))

        return parse_app_url(path)
Given a name, try to resolve the name to a path or URL to
        a declaration document. It will try:

         * The name as a filesystem path
         * The name as a file name in the directory d
         * The name + '.csv' as a name in the directory d
         * The name as a URL
         * The name as a key in the standard_declares dict
         * The name as a path in this module's metatab.declarations package