code: def encode_sagemaker_parameter(value: Any) -> str:
      """
      All values passed through the SageMaker API must be encoded as strings.
      """
      if not isinstance(value, str):
          return dump_json(value)
      else:
          return value
  
file_path: gluonts/src/gluonts/shell/sagemaker/params.py
imports: from itertools import count
  from typing import Any, Union
  from toolz import valmap
  from gluonts.core.serde import dump_json, load_json
  from gluonts.itertools import batcher
label_desc: Use image node_id 2 for calling a global function with example usage: encode_sagemaker_parameter(value) and returns: dump_json, value