code: def component(cls_name: str, render: bool) -> Component:
      obj = utils.component_or_layout_class(cls_name)(render=render)
      if isinstance(obj, BlockContext):
          raise ValueError(f"Invalid component: {obj.__class__}")
      assert isinstance(obj, Component)
      return obj
  
imports: from __future__ import annotations
  import abc
  import hashlib
  import json
  import sys
  import warnings
  from abc import ABC, abstractmethod
  from enum import Enum
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Callable
  from gradio_client.documentation import set_documentation_group
  from PIL import Image
  from gradio import utils
  from gradio.blocks import Block, BlockContext
  from gradio.component_meta import ComponentMeta
  from gradio.data_classes import GradioDataModel
  from gradio.events import EventListener
  from gradio.layouts import Form
  from gradio.processing_utils import move_files_to_cache
label_desc: Use image node_id 2 for calling a global function with example usage: component(cls_name, render) and returns: obj