code: def get_fusion_model_dict(
      model,
      single_models: Optional[Dict] = None,
  ):
      """
      Take apart a late-fusion model into a dict of single models and a fusion piece.
  
      Parameters
      ----------
      model
          A late-fusion model.
      single_models
          A dict of single models.
  
      Returns
      -------
      single_models
          A dict of single models.
      fusion_model
          The fusion part of a late-fusion model.
      """
      if not single_models:
          single_models = {}
      fusion_model = None
      if model.prefix.startswith(FUSION):  # fusion model
          fusion_model = model
          models = model.model
          model.model = None
      else:
          models = [model]
  
      for per_model in models:
          if per_model.prefix.endswith(QUERY):
              model_name = per_model.prefix[:-6]  # cut off query
          elif per_model.prefix.endswith(RESPONSE):
              model_name = per_model.prefix[:-9]
          else:
              raise ValueError(
                  f"Model prefix {per_model.prefix} doesn't end with {QUERY} or {RESPONSE}."
              )
  
          if model_name not in single_models:
              single_models[model_name] = per_model
  
      return single_models, fusion_model
  
imports: import copy
  import functools
  import heapq
  import logging
  from typing import Dict, List, Optional, Union
  import pandas
  import torch
  from omegaconf import DictConfig
  from torch import nn
  from torch.nn import functional
  from ..constants import FUSION, QUERY, RESPONSE
  from .data import data_to_df
  from .model import create_model
label_desc: Use image node_id 1 for calling a global function with example usage: get_fusion_model_dict(model, single_models) and returns: single_models,  fusion_model