code: def _component(
      name, roles, provider, version, description, is_subcomponent
  ):
      def decorator(f):
          cpn_name = name or f.__name__.lower()
          if isinstance(f, Component):
              raise TypeError(
                  "Attempted to convert a callback into a component_desc twice."
              )
          parameters = ComponentParameterDescribes()
          artifacts = ComponentArtifactDescribes()
          signatures = list(inspect.signature(f).parameters.items())
          # first two arguments are ctx and role
          if signatures[0][0] != "ctx":
              raise ComponentDeclareError(
                  "bad component_desc definition, first argument should be `ctx`"
              )
          if signatures[1][0] != "role":
              raise ComponentDeclareError(
                  "bad component_desc definition, second argument should be `role`"
              )
  
          # check if all arguments are annotated
          for k, v in signatures[2:]:
              if isinstance(
                  annotation := v.annotation, ArtifactDescribeAnnotation
              ):
                  artifacts.add(annotation, k)
              elif isinstance(annotation, ParameterDescribeAnnotation):
                  parameters.add_parameter(
                      name=k,
                      type=annotation.type,
                      default=annotation.default,
                      desc=annotation.desc,
                      optional=annotation.optional,
                  )
              else:
                  raise ComponentDeclareError(
                      f"bad component_desc definition, argument {v}{k} is not annotated"
                  )
  
          if is_subcomponent:
              artifacts.update_roles_and_stages(
                  stages=[Stage.from_str(cpn_name)], roles=roles
              )
          else:
              artifacts.update_roles_and_stages(
                  stages=[DEFAULT], roles=roles
              )
          desc = description
          if desc is None:
              desc = inspect.getdoc(f)
              if isinstance(desc, bytes):
                  desc = desc.decode("utf-8")
          else:
              desc = inspect.cleandoc(desc)
          cpn = Component(
              name=cpn_name,
              roles=roles,
              provider=provider,
              version=version,
              description=desc,
              callback=f,
              parameters=parameters,
              artifacts=artifacts,
              is_subcomponent=is_subcomponent,
          )
          cpn.__doc__ = f.__doc__
          return cpn
  
      return decorator
  
imports: import inspect
  import logging
  from typing import List, Optional
  from fate.components.core.essential import CROSS_VALIDATION, DEFAULT, PREDICT, TRAIN, Role, Stage
  from ._component_artifact import ArtifactDescribeAnnotation, ComponentArtifactDescribes
  from ._parameter import ComponentParameterDescribes, ParameterDescribeAnnotation
label_desc: Use image node_id 2 for calling a global function with example usage: _component(name, roles, provider, version, description, is_subcomponent) and returns: decorator, cpn