def linkcode_resolve(domain, info):
if domain != '<STR_LIT>':<EOL><INDENT>return None<EOL><DEDENT>modname = info['<STR_LIT>']<EOL>fullname = info['<STR_LIT>']<EOL>submod = sys.modules.get(modname)<EOL>if submod is None:<EOL><INDENT>return None<EOL><DEDENT>obj = submod<EOL>for part in fullname.split('<STR_LIT:.>'):<EOL><INDENT>try:<EOL><INDENT>obj = getattr(obj, part)<EOL><DEDENT>except:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>try:<EOL><INDENT>obj = obj.im_func.func_closure[<NUM_LIT:0>].cell_contents<EOL><DEDENT>except (AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>fn = inspect.getsourcefile(obj)<EOL><DEDENT>except:<EOL><INDENT>fn = None<EOL><DEDENT>if not fn:<EOL><INDENT>try:<EOL><INDENT>fn = inspect.getsourcefile(sys.modules[obj.__module__])<EOL><DEDENT>except:<EOL><INDENT>fn = None<EOL><DEDENT><DEDENT>if not fn:<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>source, lineno = inspect.findsource(obj)<EOL><DEDENT>except:<EOL><INDENT>lineno = None<EOL><DEDENT>if lineno:<EOL><INDENT>linespec = "<STR_LIT>" % (lineno + <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>linespec = "<STR_LIT>"<EOL><DEDENT>fn = os.path.relpath(fn, start=os.path.dirname(gwpy.__file__))<EOL>if fn.startswith(os.path.pardir):<EOL><INDENT>return None<EOL><DEDENT>return ("<STR_LIT>"<EOL>% (GWPY_VERSION['<STR_LIT>'], fn, linespec))<EOL>
Determine the URL corresponding to Python object

    This code is stolen with thanks from the scipy team.