code: def test_create_collection_nested_success(sagemaker_session):
      collection = Collection(sagemaker_session)
      collection_name = unique_name_from_base("test-collection")
      child_collection_name = unique_name_from_base("test-collection-2")
      collection.create(collection_name)
      collection.create(
          collection_name=child_collection_name,
          parent_collection_name=collection_name,
      )
      collection_filter = [
          {
              "Name": "resource-type",
              "Values": [
                  "AWS::ResourceGroups::Group",
                  "AWS::SageMaker::ModelPackageGroup",
              ],
          },
      ]
      collection_details = sagemaker_session.list_group_resources(
          group=collection_name, filters=collection_filter
      )
      # has one child i.e child collection
      assert len(collection_details["Resources"]) == 1
  
      collection_details = sagemaker_session.list_group_resources(
          group=child_collection_name, filters=collection_filter
      )
      collection_details["ResponseMetadata"]["HTTPStatusCode"]
      delete_response = collection.delete(
          [child_collection_name, collection_name]
      )
      assert len(delete_response["deleted_collections"]) == 2
      assert len(delete_response["delete_collection_failures"]) == 0
  
imports: from __future__ import absolute_import
  from sagemaker.utils import unique_name_from_base
  from sagemaker.collection import Collection
label_desc: Use image node_id 2 for calling a global function with example usage: test_create_collection_nested_success(sagemaker_session) without return types