def extractor(
        builder_name: str, builder: Builder, build_file_path: str,
        build_context) -> types.FunctionType:
    """Return a target extraction function for a specific builder and a
       specific build file."""
    build_module = to_build_module(build_file_path, build_context.conf)

    def extract_target(*args, **kwargs):
        """The actual target extraction function that is executed when any
           builder function is called in a build file."""
        target = Target(builder_name=builder_name)
        # convert args/kwargs to target.props and handle arg types
        args_to_props(target, builder, args, kwargs)
        raw_name = target.props.name
        handle_typed_args(target, builder, build_module)
        logger.debug('Extracting target: {}', target)
        # promote the `name` and `deps` from props to the target instance
        target.name = target.props.pop('name')
        target.deps = target.props.pop('deps', [])
        if target.deps:
            logger.debug('Got deps for target "{0.name}": {0.deps}', target)
        # invoke builder hooks on extracted target
        for hook_name, hook in Plugin.get_hooks_for_builder(builder_name):
            logger.debug('About to invoke hook {} on target {}',
                         hook_name, target)
            hook(build_context, target)
        # save the target in the build context
        build_context.register_target(target)
        logger.debug('Registered {}', target)

    return extract_target
Return a target extraction function for a specific builder and a
       specific build file.