def linkcode_resolve(domain, info):
    """
    Determine the URL corresponding to Python object

    Adapted from scipy.
    """
    import sksurv

    if domain != 'py':
        return None

    modname = info['module']
    fullname = info['fullname']

    submod = sys.modules.get(modname)
    if submod is None:
        return None

    obj = submod
    for part in fullname.split('.'):
        try:
            obj = getattr(obj, part)
        except AttributeError:
            return None

    try:
        fn = inspect.getsourcefile(obj)
    except TypeError:
        fn = None
    if fn is None and hasattr(obj, '__module__'):
        fn = inspect.getsourcefile(sys.modules[obj.__module__])
    if fn is None:
        return None

    try:
        source, lineno = inspect.getsourcelines(obj)
    except ValueError:
        lineno = None

    if lineno:
        linespec = '#L%d-L%d' % (lineno, lineno + len(source) - 1)
    else:
        linespec = ''

    startdir = Path(sksurv.__file__).parent.parent.absolute()
    if not fn.startswith(str(startdir)):  # not in sksurv
        return None
    fn = '/'.join(Path(fn).relative_to(startdir).parts)

    if fn.startswith('sksurv/'):
        m = re.match(r'^.*dev[0-9]+\+g([a-f0-9]+)$', release)
        if m:
            branch = m.group(1)
        elif 'dev' in release:
            branch = 'master'
        else:
            branch = 'v{}'.format(release)
        return 'https://github.com/sebp/scikit-survival/blob/{branch}/{filename}{linespec}'.format(
            branch=branch,
            filename=fn,
            linespec=linespec
        )
    else:
        return None