code: def _tuple_converter(
      d: NestedDictStrAny | None,
  ) -> NestedDictStrAny | None:
      # handles case for struct_pb2.Value where nested items are tuple.
      # if that is the case, then convert to list.
      # This dict is only one level deep, as we don't allow nested Multipart.
      if d is not None:
          for key, value in d.items():
              if isinstance(value, tuple):
                  d[key] = list(t.cast("TupleAny", value))
              elif isinstance(value, dict):
                  d[key] = _tuple_converter(
                      t.cast("NestedDictStrAny", value)
                  )
      return d
  
file_path: BentoML/src/bentoml/_internal/server/grpc/servicer/v1/__init__.py
imports: from __future__ import annotations
  import logging
  import sys
  import typing
  from typing import TYPE_CHECKING
  import anyio
  from ......exceptions import BentoMLException
  from ......exceptions import InvalidArgument
  from ......grpc.utils import grpc_status_code
  from ......grpc.utils import import_generated_stubs
  from ......grpc.utils import import_grpc
  from ......grpc.utils import validate_proto_fields
  from .....utils import LazyLoader
  from .....utils import is_async_callable
label_desc: Use image node_id 3 for calling a global function with example usage: _tuple_converter(d) and returns: d