code: def load_components(metadata_path, namespace="default_namespace"):
      """Load React component metadata into a format Dash can parse.
  
      Usage: load_components('../../component-suites/lib/metadata.json')
  
      Keyword arguments:
      metadata_path -- a path to a JSON file created by
      [`react-docgen`](https://github.com/reactjs/react-docgen).
  
      Returns:
      components -- a list of component objects with keys
      `type`, `valid_kwargs`, and `setup`.
      """
  
      # Register the component lib for index include.
      ComponentRegistry.registry.add(namespace)
      components = []
  
      data = _get_metadata(metadata_path)
  
      # Iterate over each property name (which is a path to the component)
      for componentPath in data:
          componentData = data[componentPath]
  
          # Extract component name from path
          # e.g. src/components/MyControl.react.js
          # TODO Make more robust - some folks will write .jsx and others
          # will be on windows. Unfortunately react-docgen doesn't include
          # the name of the component atm.
          name = componentPath.split("/").pop().split(".")[0]
          component = generate_class(
              name,
              componentData["props"],
              componentData["description"],
              namespace,
              None,
          )
  
          components.append(component)
  
      return components
  
file_path: dash/dash/development/component_loader.py
imports: import collections
  import json
  import os
  from ._py_components_generation import generate_class_file, generate_imports, generate_classes_files, generate_class
  from .base_component import ComponentRegistry
label_desc: Use image node_id 2 for calling a global function with example usage: load_components(metadata_path, namespace) and returns: components