def METHOD_NAME(path, layer, os_name, variant, os_version = "9", os_id = "centos", ansi_color = "0;34", api_versions = {}, use_antlir2 = False):
    """
    Build an `os-release` file and install it at the provided `path` location.
    See https://www.freedesktop.org/software/systemd/man/os-release.html
    for a detailed description of this from upstream.  The purpose of this API
    is to provide a means to include metadata about the VCS revision and
    buck target of the `image.layer` that this os-release file is being
    installed into.
    `layer`: A relative target path to the layer that the `os-release` file
             will be installed into. It is fully normallized and then inserted
             as the IMAGE_LAYER key.
             Note: the need to include this is an unfortunate wart in the current
             Antlir implementation mainly due to Buck's inability to provide
             context about the target graph when targets are built. Buck2 might
             help solve that core problem, but another approach is to support
             the generation of this file directly in the Compiler itself.
    `os_name`: Populates the NAME key and `os_name.lower()` populates the ID key.
    `variant`: Populates the VARIANT key and `variant.lower()` populates the VARIANT_ID key.
    `ansi_color`: Populates the ANSI_COLOR key.
    `api_versions`: A means of expressing the (preferably monotonically
                    increasing) API version for various MetalOS features
                    embedded in the image. Populates API_VER_{KEY}={val} for
                    each provided pair. Keys must be uppercase alpha and
                    underscores only; values must be integers. Absolute values
                    are intended to be meaningless, but they are integers for
                    easy comparison so we can express things like "only if
                    FOO_API is greater than 11"
    The current VCS rev, as a SHA-1 hash, is captured and the entire IMAGE_VCS_REV key
    and a few others, as describe below.
    The current VCS rev timestamp, in ISO-8601 format, is used as both the VERSION and
    IMAGE_VCS_REV_TIME keys.
    The PRETTY_NAME key is formatted as:
      {os_name} {variant} ({revision})
    """
    if not layer.startswith(":"):
        fail("Please provide `layer` as a relative target name.")
    name = layer[1:] + "__os-release"
    if not types.is_dict(api_versions) or any(
        [
            (
                not types.is_string(k) or
                not types.is_int(v) or
                k.islower() or
                not k.replace("_", "Z").isalpha() or
                k.startswith("_") or
                k.endswith("_")
            )
            for k, v in api_versions.items()
        ],
    ):
        fail(
            "api_versions must be specified as a dictionary of uppercase keys and int values",
        )
    api_vers = "\n".join(
        sorted(
            ['API_VER_{}="{}"'.format(key, val) for key, val in api_versions.items()],
        ),
    )
    buck_genrule(
        name = name,
        bash = r"""