code: def test_registry():
      backbones = FlashRegistry("backbones")
  
      @backbones
      def my_model(nc_input=5, nc_output=6):
          return nn.Linear(nc_input, nc_output), nc_input, nc_output
  
      mlp, nc_input, nc_output = backbones.get("my_model")(nc_output=7)
      assert nc_input == 5
      assert nc_output == 7
      assert mlp.weight.shape == (7, 5)
  
      # basic get
      backbones(my_model, name="foo")
      assert backbones.get("foo")
  
      # test override
      backbones(my_model, name="foo", override=True)
      functions = backbones.get("foo", strict=False)
      assert len(functions) == 1
  
      # test metadata filtering
      backbones(my_model, name="foo", namespace="timm", type="resnet")
      backbones(
          my_model, name="foo", namespace="torchvision", type="resnet"
      )
      backbones(my_model, name="foo", namespace="timm", type="densenet")
      backbones(my_model, name="foo", namespace="timm", type="alexnet")
      function = backbones.get(
          "foo", with_metadata=True, type="resnet", namespace="timm"
      )
      assert function["name"] == "foo"
      assert function["metadata"] == {
          "namespace": "timm",
          "type": "resnet",
      }
  
      # test strict=False and with_metadata=False
      functions = backbones.get("foo", namespace="timm", strict=False)
      assert len(functions) == 3
      assert all(callable(f) for f in functions)
  
      # test available keys
      assert backbones.available_keys() == [
          "foo",
          "foo",
          "foo",
          "foo",
          "foo",
          "my_model",
      ]
  
file_path: lightning-flash/tests/core/test_registry.py
imports: import logging
  import pytest
  from flash.core.registry import ConcatRegistry, ExternalRegistry, FlashRegistry
  from flash.core.utilities.imports import _TOPIC_CORE_AVAILABLE
  from torch import nn
label_desc: Use image node_id 2 for calling a global function with example usage: test_registry() and returns: nn,  nc_input,  nc_output