code: def to_env_vars(mapping):  # type: (dict) -> dict
      
  
      def format_key(key):
          """Decode a key, adds a SM_ prefix to the key and upper case it"""
          if key:
              decoded_name = 'SM_%s' % str(key).upper()
              return decoded_name
          else:
              return ''
  
      def format_value(_mapping):
          if six.PY3 and isinstance(_mapping, six.binary_type):
              # transforms a byte string (b'') in unicode
              return _mapping.decode('latin1')
          elif _mapping is None:
              return ''
          elif isinstance(_mapping, six.string_types):
              return str(_mapping)
          else:
              return json.dumps(_mapping, sort_keys=True, separators=(',', ':'), ensure_ascii=True)
  
      return {format_key(k): format_value(v) for k, v in mapping.items()}
docs: Transform a dictionary in a dictionary of env vars.
       Example:
           >>>env_vars = mapping.to_env_vars({'model_dir': '/opt/ml/model', 'batch_size': 25})
           >>>
           >>>print(args)
           ['MODEL_DIR', '/opt/ml/model', 'BATCH_SIZE', 25]
       Args:
           mapping (dict[str, object]): A Python mapping.
       Returns:
           (dict): Dictionary of env vars