code: def test_group_collections(self):
      params = {"dense1": {"x": [10, 20]}}
      batch_stats = {"dense1": {"ema": 5}}
      xs = {"params": params, "batch_stats": batch_stats}
  
      # Retrieve all keys only once.
      group = scope.group_collections(xs, ["params", "params"])
      self.assertEqual(group, ({"params": params}, {}))
  
      # Ignore non-existing keys.
      self.assertEqual(scope.group_collections(xs, ["vars"]), ({},))
  
      # False gets nothing and True retrieves all keys once.
      self.assertEqual(
          scope.group_collections(xs, [False, True, True]), ({}, xs, {})
      )
  
imports: import jax
  import numpy
  from absl.testing import absltest
  from jax import numpy
  from jax import random
  from flax import errors
  from flax.configurations import temp_flip_flag
  from flax.core import Scope, apply, freeze, init, lazy_init, nn, scope
  from flax.core.scope import LazyRng
label_desc: Use image node_id 6 for calling the ScopeTest obj's underlying member method code with example usage: obj.test_group_collections() without return types