code: def select_data_adapter(x, y):
      """Selects a data adapter than can handle a given x and y."""
      adapter_cls = [
          cls for cls in ALL_ADAPTER_CLS if cls.can_handle(x, y)
      ]
      if not adapter_cls:
          raise ValueError(
              "Failed to find data adapter that can handle "
              "input: {}, {}".format(_type_name(x), _type_name(y))
          )
      elif len(adapter_cls) > 1:
          raise RuntimeError(
              "Data adapters should be mutually exclusive for "
              "handling inputs. Found multiple adapters {} to handle "
              "input: {}, {}".format(
                  adapter_cls, _type_name(x), _type_name(y)
              )
          )
      return adapter_cls[0]
  
file_path: elegy/elegy/data/data_handler.py
imports: import contextlib
  import logging
  from .array_adapter import ArrayDataAdapter
  from .dataset import DataLoaderAdapter
  from .generator_adapter import GeneratorDataAdapter
  from .list_adapter import ListsOfScalarsDataAdapter
label_desc: Use image node_id 2 for calling a global function with example usage: select_data_adapter(x, y) and returns: adapter_cls