code: def _parse_composition_kwargs(
      **kwargs: Union[ModelComponent, Endpoint]
  ) -> Tuple[Dict[str, ModelComponent], Dict[str, Endpoint]]:
      components, endpoints = {}, {}
      for k, v in kwargs.items():
          if isinstance(v, ModelComponent):
              components[k] = v
          elif isinstance(v, Endpoint):
              endpoints[k] = v
          else:
              raise TypeError(
                  f"{k}={v} is not valid type (recieved {type(v)}"
              )
  
      if len(components) > 1 and len(endpoints) == 0:
          raise ValueError(
              "Must explicitly define atelast one Endpoint when "
              "two or more components are included in a composition."
          )
      return components, endpoints
  
file_path: lightning-flash/src/flash/core/serve/composition.py
imports: import itertools
  from dataclasses import asdict
  from typing import Dict, List, Tuple, Union
  from flash.core.serve.component import ModelComponent
  from flash.core.serve.core import Connection, Endpoint
  from flash.core.serve.interfaces.models import EndpointProtocol
  from flash.core.serve.server import ServerMixin
  from flash.core.utilities.imports import _CYTOOLZ_AVAILABLE
label_desc: Use image node_id 1 for calling a global function with example usage: _parse_composition_kwargs() and returns: components,  endpoints