def METHOD_NAME(Script, code, type_):
    """
    If goto_stubs is used on an identifier in e.g. the stdlib, we should goto
    the stub of it.
    """
    s = Script(code)
    if type_ == 'infer':
        def_, = s.infer()
    else:
        def_, = s.goto(follow_imports=True)
    stub, = def_.goto(only_stubs=True)
    script_on_source = Script(path=def_.module_path)
    if type_ == 'infer':
        definition, = script_on_source.infer(def_.line, def_.column)
    else:
        definition, = script_on_source.goto(def_.line, def_.column)
    same_stub, = definition.goto(only_stubs=True)
    _assert_is_same(same_stub, stub)
    _assert_is_same(definition, def_)
    assert same_stub.module_path != def_.module_path
    # And the reverse.
    script_on_stub = Script(
        path=same_stub.module_path,
    )
    if type_ == 'infer':
        same_definition, = script_on_stub.infer(same_stub.line, same_stub.column)
        same_definition2, = same_stub.infer()
    else:
        same_definition, = script_on_stub.goto(same_stub.line, same_stub.column)
        same_definition2, = same_stub.goto()
    _assert_is_same(same_definition, definition)
    _assert_is_same(same_definition, same_definition2)