def find_declare_doc(self, d, name):
path = None<EOL>while True:<EOL><INDENT>if exists(name):<EOL><INDENT>path =name<EOL>break<EOL><DEDENT>try:<EOL><INDENT>path = declaration_path(name)<EOL>break<EOL><DEDENT>except IncludeError:<EOL><INDENT>pass<EOL><DEDENT>for fn in (join(d, name), join(d, name + '<STR_LIT>')):<EOL><INDENT>if exists(fn):<EOL><INDENT>path = fn<EOL>break<EOL><DEDENT><DEDENT>if path:<EOL><INDENT>break<EOL><DEDENT>if name.startswith('<STR_LIT:http>'):<EOL><INDENT>path = name.strip('<STR_LIT:/>')  <EOL>break<EOL><DEDENT>elif exists(name):<EOL><INDENT>path = name<EOL>break<EOL><DEDENT>else:<EOL><INDENT>path = self.resolver.find_decl_doc(name)<EOL>break<EOL><DEDENT>raise IncludeError("<STR_LIT>".format(name))<EOL><DEDENT>return parse_app_url(path)<EOL>
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