def GetLabelsMessageWithCosVersion(labels, image_uri, resources, resource_class):
    'Returns message with labels for instance / instance template.\n\n  Args:\n    labels: dict, labels to assign to the resource.\n    image_uri: URI of image used as a base for the resource. The function\n               extracts COS version from the URI and uses it as a value of\n               `container-vm` label.\n    resources: object that can parse image_uri.\n    resource_class: class of the resource to which labels will be assigned.\n                    Must contain LabelsValue class and\n                    resource_class.LabelsValue must contain AdditionalProperty\n                    class.\n  '
    cos_version = resources.Parse(image_uri, collection='compute.images').Name().replace('/', '-')
    if (labels is None):
        labels = {}
    labels['container-vm'] = cos_version
    additional_properties = [resource_class.LabelsValue.AdditionalProperty(key=k, value=v) for (k, v) in sorted(six.iteritems(labels))]
    return resource_class.LabelsValue(additionalProperties=additional_properties)
Returns message with labels for instance / instance template.

Args:
  labels: dict, labels to assign to the resource.
  image_uri: URI of image used as a base for the resource. The function
             extracts COS version from the URI and uses it as a value of
             `container-vm` label.
  resources: object that can parse image_uri.
  resource_class: class of the resource to which labels will be assigned.
                  Must contain LabelsValue class and
                  resource_class.LabelsValue must contain AdditionalProperty
                  class.
def GetLabelsMessageWithCosVersion(labels, image_uri, resources, resource_class):
    'Returns message with labels for instance / instance template.\n\n  Args:\n    labels: dict, labels to assign to the resource.\n    image_uri: URI of image used as a base for the resource. The function\n               extracts COS version from the URI and uses it as a value of\n               `container-vm` label.\n    resources: object that can parse image_uri.\n    resource_class: class of the resource to which labels will be assigned.\n                    Must contain LabelsValue class and\n                    resource_class.LabelsValue must contain AdditionalProperty\n                    class.\n  '
    cos_version = resources.Parse(image_uri, collection='compute.images').Name().replace('/', '-')
    if (labels is None):
        labels = {}
    labels['container-vm'] = cos_version
    additional_properties = [resource_class.LabelsValue.AdditionalProperty(key=k, value=v) for (k, v) in sorted(six.iteritems(labels))]
    return resource_class.LabelsValue(additionalProperties=additional_properties)