code: def get_down_block(
      down_block_type,
      num_layers,
      in_channels,
      out_channels,
      temb_channels,
      add_downsample,
      resnet_eps,
      resnet_act_fn,
      num_attention_heads,
      resnet_groups=None,
      cross_attention_dim=None,
      downsample_padding=None,
      dual_cross_attention=False,
      use_linear_projection=False,
      only_cross_attention=False,
      upcast_attention=False,
      resnet_time_scale_shift="default",
      resnet_skip_time_act=False,
      resnet_out_scale_factor=1.0,
      cross_attention_norm=None,
      dropout=0.0,
  ):
      down_block_type = (
          down_block_type[7:]
          if down_block_type.startswith("UNetRes")
          else down_block_type
      )
      if down_block_type == "DownBlockFlat":
          return DownBlockFlat(
              num_layers=num_layers,
              in_channels=in_channels,
              out_channels=out_channels,
              temb_channels=temb_channels,
              dropout=dropout,
              add_downsample=add_downsample,
              resnet_eps=resnet_eps,
              resnet_act_fn=resnet_act_fn,
              resnet_groups=resnet_groups,
              downsample_padding=downsample_padding,
              resnet_time_scale_shift=resnet_time_scale_shift,
          )
      elif down_block_type == "CrossAttnDownBlockFlat":
          if cross_attention_dim is None:
              raise ValueError(
                  "cross_attention_dim must be specified for CrossAttnDownBlockFlat"
              )
          return CrossAttnDownBlockFlat(
              num_layers=num_layers,
              in_channels=in_channels,
              out_channels=out_channels,
              temb_channels=temb_channels,
              dropout=dropout,
              add_downsample=add_downsample,
              resnet_eps=resnet_eps,
              resnet_act_fn=resnet_act_fn,
              resnet_groups=resnet_groups,
              downsample_padding=downsample_padding,
              cross_attention_dim=cross_attention_dim,
              num_attention_heads=num_attention_heads,
              dual_cross_attention=dual_cross_attention,
              use_linear_projection=use_linear_projection,
              only_cross_attention=only_cross_attention,
              resnet_time_scale_shift=resnet_time_scale_shift,
          )
      raise ValueError(f"{down_block_type} is not supported.")
  
imports: from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from ...configuration_utils import ConfigMixin, register_to_config
  from ...models import ModelMixin
  from ...models.activations import get_activation
  from ...models.attention import Attention
  from ...models.attention_processor import ADDED_KV_ATTENTION_PROCESSORS, CROSS_ATTENTION_PROCESSORS, AttentionProcessor, AttnAddedKVProcessor, AttnAddedKVProcessor2_0, AttnProcessor
  from ...models.dual_transformer_2d import DualTransformer2DModel
  from ...models.embeddings import GaussianFourierProjection, ImageHintTimeEmbedding, ImageProjection, ImageTimeEmbedding, TextImageProjection, TextImageTimeEmbedding, TextTimeEmbedding, TimestepEmbedding, Timesteps
  from ...models.transformer_2d import Transformer2DModel
  from ...models.unet_2d_condition import UNet2DConditionOutput
  from ...utils import USE_PEFT_BACKEND, is_torch_version, logging, scale_lora_layers, unscale_lora_layers
  from ...utils.torch_utils import apply_freeu
label_desc: Use image node_id 1 for calling a global function with example usage: get_down_block(down_block_type, num_layers, in_channels, out_channels, temb_channels, add_downsample, resnet_eps, resnet_act_fn, num_attention_heads, resnet_groups, cross_attention_dim, downsample_padding, dual_cross_attention, use_linear_projection, only_cross_attention, upcast_attention, resnet_time_scale_shift, resnet_skip_time_act, resnet_out_scale_factor, cross_attention_norm, dropout) and returns: DownBlockFlat, CrossAttnDownBlockFlat