code: def build_head(config):
      """Builds a ClassyHead from a config.
  
      This assumes a 'name' key in the config which is used to determine what
      head class to instantiate. For instance, a config `{"name": "my_head",
      "foo": "bar"}` will find a class that was registered as "my_head"
      (see :func:`register_head`) and call .from_config on it."""
  
      assert "name" in config, "Expect name in config"
      assert (
          "unique_id" in config
      ), "Expect a global unique id in config"
      assert config["name"] in HEAD_REGISTRY, "unknown head {}".format(
          config["name"]
      )
      name = config["name"]
      head_config = copy.deepcopy(config)
      del head_config["name"]
      return HEAD_REGISTRY[name].from_config(head_config)
  
file_path: ClassyVision/classy_vision/heads/__init__.py
imports: import copy
  import traceback
  from pathlib import Path
  from classy_vision.generic.registry_utils import import_all_modules
  from .classy_head import ClassyHead
  from .fully_connected_head import FullyConnectedHead
  from .fully_convolutional_linear_head import FullyConvolutionalLinearHead
  from .identity_head import IdentityHead
  from .vision_transformer_head import VisionTransformerHead
label_desc: Use image node_id 2 for calling a global function with example usage: build_head(config) and returns: HEAD_REGISTRY