def _add_entry_attr(
        ctx,
        arguments,
        argument_name,
        universal_entry_value = None):
    """Using a priority scheme, adds the entry point to the 'arguments'.

    The entry point value can come from three location:
        local - argument list (highest priority)
        global - the rule's context
        universal - outside the rule's context (lowest priority)

    The entry point value is added to the 'arguments' using the priority scheme.

    Args:
      ctx: The current rule's context object.
      arguments: The arguments dictionary.
      argument_name: The argument name to lookup in the arguments dictionary.
      universal_entry_value: The 'universal' entry point value. The value is
        outside the rule's context.

    Returns:
      If the entry value is present in one of the locations, a copy of the
      argument dictionary with the entry point value added. Otherwise, return
      the argument dictionary untouched.
    """
    my_arguments = dict(arguments)
    if argument_name not in my_arguments:
        if hasattr(ctx.attr, "entry") and ctx.attr.entry != "":
            my_arguments[argument_name] = ctx.attr.entry
        elif universal_entry_value:
            my_arguments[argument_name] = universal_entry_value
    return my_arguments