code: def convert_diffusers_name_to_compvis(key, is_sd2):
      def match(match_list, regex_text):
          regex = re_compiled.get(regex_text)
          if regex is None:
              regex = re.compile(regex_text)
              re_compiled[regex_text] = regex
  
          r = re.match(regex, key)
          if not r:
              return False
  
          match_list.clear()
          match_list.extend(
              [
                  int(x) if re.match(re_digits, x) else x
                  for x in r.groups()
              ]
          )
          return True
  
      m = []
  
      if match(m, r"lora_unet_conv_in(.*)"):
          return f"diffusion_model_input_blocks_0_0{m[0]}"
  
      if match(m, r"lora_unet_conv_out(.*)"):
          return f"diffusion_model_out_2{m[0]}"
  
      if match(m, r"lora_unet_time_embedding_linear_(\d+)(.*)"):
          return f"diffusion_model_time_embed_{m[0] * 2 - 2}{m[1]}"
  
      if match(
          m,
          r"lora_unet_down_blocks_(\d+)_(attentions|resnets)_(\d+)_(.+)",
      ):
          suffix = suffix_conversion.get(m[1], {}).get(m[3], m[3])
          return f"diffusion_model_input_blocks_{1 + m[0] * 3 + m[2]}_{1 if m[1] == 'attentions' else 0}_{suffix}"
  
      if match(
          m, r"lora_unet_mid_block_(attentions|resnets)_(\d+)_(.+)"
      ):
          suffix = suffix_conversion.get(m[0], {}).get(m[2], m[2])
          return f"diffusion_model_middle_block_{1 if m[0] == 'attentions' else m[1] * 2}_{suffix}"
  
      if match(
          m,
          r"lora_unet_up_blocks_(\d+)_(attentions|resnets)_(\d+)_(.+)",
      ):
          suffix = suffix_conversion.get(m[1], {}).get(m[3], m[3])
          return f"diffusion_model_output_blocks_{m[0] * 3 + m[2]}_{1 if m[1] == 'attentions' else 0}_{suffix}"
  
      if match(m, r"lora_unet_down_blocks_(\d+)_downsamplers_0_conv"):
          return f"diffusion_model_input_blocks_{3 + m[0] * 3}_0_op"
  
      if match(m, r"lora_unet_up_blocks_(\d+)_upsamplers_0_conv"):
          return f"diffusion_model_output_blocks_{2 + m[0] * 3}_{2 if m[0]>0 else 1}_conv"
  
      if match(m, r"lora_te_text_model_encoder_layers_(\d+)_(.+)"):
          if is_sd2:
              if "mlp_fc1" in m[1]:
                  return f"model_transformer_resblocks_{m[0]}_{m[1].replace('mlp_fc1', 'mlp_c_fc')}"
              elif "mlp_fc2" in m[1]:
                  return f"model_transformer_resblocks_{m[0]}_{m[1].replace('mlp_fc2', 'mlp_c_proj')}"
              else:
                  return f"model_transformer_resblocks_{m[0]}_{m[1].replace('self_attn', 'attn')}"
  
          return f"transformer_text_model_encoder_layers_{m[0]}_{m[1]}"
  
      if match(m, r"lora_te2_text_model_encoder_layers_(\d+)_(.+)"):
          if "mlp_fc1" in m[1]:
              return f"1_model_transformer_resblocks_{m[0]}_{m[1].replace('mlp_fc1', 'mlp_c_fc')}"
          elif "mlp_fc2" in m[1]:
              return f"1_model_transformer_resblocks_{m[0]}_{m[1].replace('mlp_fc2', 'mlp_c_proj')}"
          else:
              return f"1_model_transformer_resblocks_{m[0]}_{m[1].replace('self_attn', 'attn')}"
  
      return key
  
imports: import logging
  import os
  import re
  import lora_patches
  import network
  import network_lora
  import network_glora
  import network_hada
  import network_ia3
  import network_lokr
  import network_full
  import network_norm
  import network_oft
  import torch
  from typing import Union
  from modules import shared, devices, sd_models, errors, scripts, sd_hijack
  import modules.textual_inversion.textual_inversion
  from lora_logger import logger
label_desc: Use image node_id 1 for calling a global function with example usage: convert_diffusers_name_to_compvis(key, is_sd2) and returns: key, True, str, m, str, m, str, unknown, m, str, unknown, str, unknown, str, suffix, str, unknown, str, suffix, str, unknown, str, unknown, str, suffix, str, unknown, str, str, unknown, str, unknown, str, str, m, str, m, False, str, m, str, m, str, m, str, m, str, m, str, m, str, m, str, m, str, m, str, m, str, m, str, m