def _new_entitlements_artifact(ctx, extension):
    """Returns a new file artifact for entitlements.

    This function creates a new file in an "entitlements" directory in the
    target's location whose name is the target's name with the given extension.

    Args:
      ctx: The Skylark context.
      extension: The file extension (including the leading dot).

    Returns:
      The requested file object.
    """
    return ctx.actions.declare_file(
        "entitlements/%s%s" % (ctx.label.name, extension),
    )