code: def component(
      roles: List[Role],
      name: Optional[str] = None,
      provider: Optional[str] = None,
      version: Optional[str] = None,
      description: Optional[str] = None,
  ):
      r"""Creates a new :class:`_Component` and uses the decorated function as
      callback.  This will also automatically attach all decorated
      :func:`artifact`\s and :func:`parameter`\s as parameters to the component_desc execution.
  
      The name of the component_desc defaults to the name of the function.
      If you want to change that, you can
      pass the intended name as the first argument.
  
      Once decorated the function turns into a :class:`Component` instance
      that can be invoked as a component_desc execution.
      """
      from fate import __provider__, __version__
  
      if version is None:
          version = __version__
      if provider is None:
          provider = __provider__
      return _component(
          name=name,
          roles=roles,
          provider=provider,
          version=version,
          description=description,
          is_subcomponent=False,
      )
  
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 1 for calling a global function with example usage: component(roles, name, provider, version, description) and returns: _component