class_docstr: Sets up an Amazon SageMaker Collection.
docstr: Returns the tag rule key and value for a Collection.
docstr_tok: ["Returns","the","tag","rule","key","and","value","for","a","Collection","."]
code: def _get_collection_tag_rule(self, collection_name: str):
      """Returns the tag rule key and value for a Collection."""
  
      if collection_name is not None:
          try:
              group_query = (
                  self.sagemaker_session.get_resource_group_query(
                      group=collection_name
                  )
              )
          except ClientError as e:
              error_code = e.response["Error"]["Code"]
  
              if error_code == "NotFoundException":
                  raise ValueError(
                      f"Cannot find collection: {collection_name}"
                  )
              self._check_access_error(err=e)
              raise
          if group_query.get("GroupQuery"):
              tag_rule_query = json.loads(
                  group_query["GroupQuery"]
                  .get("ResourceQuery", {})
                  .get("Query", "")
              )
              tag_rule = tag_rule_query.get("TagFilters", [])[0]
              if not tag_rule:
                  raise "Unsupported parent_collection_name"
              tag_rule_value = tag_rule["Values"][0]
              tag_rule_key = tag_rule["Key"]
  
          return {
              "tag_rule_key": tag_rule_key,
              "tag_rule_value": tag_rule_value,
          }
      raise ValueError("Collection name is required")
  
imports: from __future__ import absolute_import
  import json
  import time
  from typing import List
  from botocore.exceptions import ClientError
  from sagemaker.session import Session
label_desc: Use image node_id 7 for calling the Collection obj's underlying member method code with example usage: obj._get_collection_tag_rule(collection_name) and returns: dict