code: def data_type_to_sparse_type(data_type: DataType) -> SparseType:
      if data_type == DataType.FP32:
          return SparseType.FP32
      elif data_type == DataType.FP16:
          return SparseType.FP16
      elif data_type == DataType.BF16:
          return SparseType.BF16
      elif data_type == DataType.INT8 or data_type == DataType.UINT8:
          return SparseType.INT8
      elif data_type == DataType.INT4:
          return SparseType.INT4
      elif data_type == DataType.INT2:
          return SparseType.INT2
      else:
          raise ValueError(f"Invalid DataType {data_type}")
  
imports: from dataclasses import dataclass, field
  from enum import Enum, unique
  from functools import partial
  from math import sqrt
  from typing import Callable, Dict, List, NamedTuple, Optional
  import torch
  from fbgemm_gpu.split_embedding_configs import SparseType
  from fbgemm_gpu.split_table_batched_embeddings_ops_training import PoolingMode
  from torchrec.types import DataType
label_desc: Use image node_id 4 for calling a global function with example usage: data_type_to_sparse_type(data_type) and returns: SparseType, SparseType, SparseType, SparseType, SparseType, SparseType