code: def test_pack_unpack():
      """Test pack_kwargs and unpack_kwargs."""
      kwarg_keys, flat_args = pack_kwargs(1, 2, 3, 4)
      assert kwarg_keys == tuple()
      assert flat_args == (1, 2, 3, 4)
  
      kwarg_keys, flat_args = pack_kwargs(
          a=1, b={2: "2"}, c={3}, d=[4], e=(5,)
      )
      assert kwarg_keys == ("a", "b", "c", "d", "e")
      assert flat_args == (1, {2: "2"}, {3}, [4], (5,))
  
      kwarg_keys, flat_args = pack_kwargs(1, 2, a=3, b=4)
      assert kwarg_keys == ("a", "b")
      assert flat_args == (1, 2, 3, 4)
  
      args, kwargs = unpack_kwargs(kwarg_keys, flat_args)
      assert args == (1, 2)
      assert kwargs == {"a": 3, "b": 4}
  
      args, kwargs = unpack_kwargs([], flat_args)
      assert kwargs == {}
      assert args == (1, 2, 3, 4)
  
      args, kwargs = unpack_kwargs(["a", "b", "c", "d"], flat_args)
      assert kwargs == {"a": 1, "b": 2, "c": 3, "d": 4}
      assert args == tuple()
  
      with pytest.raises(AssertionError):
          # too many keys should assert.
          args, kwargs = unpack_kwargs(
              ["a", "b", "c", "d", "e"], flat_args
          )
  
file_path: fairscale/tests/utils/test_containers.py
imports: from collections import OrderedDict, namedtuple
  import random
  import pytest
  import torch
  import torch.nn
  from fairscale.internal.containers import apply_to_tensors, pack_kwargs, split_non_tensors, unpack_kwargs, unpack_non_tensors
label_desc: Use image node_id 2 for calling a global function with example usage: test_pack_unpack() without return types