def METHOD_NAME(name, rule, symlinked_inputs, **kwargs):
    """Wraps a rule and symlinks input files into the current directory tree.
    Args:
      rule: the rule (or macro) being wrapped.
      name: name for the generated rule.
      symlinked_inputs: a dictionary of dictionaries indicating label-list
        arguments labels that should be passed to the generated rule after
        being symlinked into the specified directory. For example:
        {"srcs": {"bar": ["//foo/bar:bar.txt"]}}
      **kwargs: additional keyword arguments to forward to the generated rule.
    """
    for kwarg, mapping in symlinked_inputs.items():
        for dst, files in mapping.items():
            if kwarg in kwargs:
                fail(
                    "key %s is already present in this rule" % (kwarg,),
                    attr = "symlinked_inputs",
                )
            if dst == None:
                kwargs[kwarg] = files
            else:
                symlinked_target_name = "_{}_{}".format(name, kwarg)
                symlink_files(
                    name = symlinked_target_name,
                    dst = dst,
                    srcs = files,
                    flatten = True,
                )
                kwargs[kwarg] = [":" + symlinked_target_name]
    rule(
        name = name,
        **kwargs
    )