code: def validate_dense_feat(
      batch_element_dense_feat: Optional[List[List[float]]],
      length: int,
      uses_dense_feat: bool,
  ) -> List[List[float]]:
      if batch_element_dense_feat is not None:
          if not uses_dense_feat:
              raise RuntimeError(
                  "Dense feature (dense_feat) not allowed for this model type"
              )
          if len(batch_element_dense_feat) != length:
              raise RuntimeError(
                  "Malformed request.  Length of client-batch dense_feat argument does not match length of text argument."
              )
          return batch_element_dense_feat
      elif uses_dense_feat:
          raise RuntimeError(
              "Dense feature (dense_feat) is required for this model type, but not present (received dense_feat=None) in this request."
          )
      else:
          return []
  
imports: from typing import Any, Dict, List, Optional, Tuple
  import torch
  from pytext.torchscript.tensorizer.tensorizer import ScriptTensorizer
label_desc: Use image node_id 9 for calling a global function with example usage: validate_dense_feat(batch_element_dense_feat, length, uses_dense_feat) and returns: batch_element_dense_feat, list