def group_id_from_metadata(metadata):
    """
    Get the group ID of a server based on the metadata.

    The old key was ``rax:auto_scaling_group_id``, but the new key is
    ``rax:autoscale:group:id``.  Try pulling from the new key first, and
    if it doesn't exist, pull from the old.
    """
    return metadata.get(
        "rax:autoscale:group:id",
        metadata.get("rax:auto_scaling_group_id", None))