def handle_import(self, name, compilation, rule):
        path = PurePosixPath(name)
        search_exts = list(compilation.compiler.dynamic_extensions)
        if path.suffix and path.suffix in search_exts:
            basename = path.stem
        else:
            basename = path.name
        relative_to = path.parent
        search_path = []
        if relative_to.is_absolute():
            relative_to = PurePosixPath(*relative_to.parts[1:])
        elif rule.source_file.origin:
            search_path.append((
                rule.source_file.origin,
                rule.source_file.relpath.parent / relative_to,
            ))
        search_path.extend(
            (origin, relative_to)
            for origin in compilation.compiler.search_path
        )
        for prefix, suffix in product(('_', ''), search_exts):
            filename = prefix + basename + suffix
            for origin, relative_to in search_path:
                relpath = relative_to / filename
                relpath = PurePosixPath(os.path.normpath(str(relpath)))
                if rule.source_file.key == (origin, relpath):
                    continue
                path = origin / relpath
                if not path.exists():
                    continue
                return SourceFile.read(origin, relpath)