code: def _info_to_string(info):
    
    for key in _TENSORBOARD_INFO_FIELDS:
      field_type = _TENSORBOARD_INFO_FIELDS[key]
      if not isinstance(getattr(info, key), field_type.runtime_type):
        raise ValueError(
            "expected %r of type %s, but found: %r" %
            (key, field_type.runtime_type, getattr(info, key))
        )
    if info.version != version.VERSION:
      raise ValueError(
          "expected 'version' to be %r, but found: %r" %
          (version.VERSION, info.version)
      )
    json_value = {
        k: _TENSORBOARD_INFO_FIELDS[k].serialize(getattr(info, k))
        for k in _TENSORBOARD_INFO_FIELDS
    }
    return json.dumps(json_value, sort_keys=True, indent=4)
docs: Convert a `TensorBoardInfo` to string form to be stored on disk.
  
    The format returned by this function is opaque and should only be
    interpreted by `_info_from_string`.
  
    Args:
      info: A valid `TensorBoardInfo` object.
  
    Raises:
      ValueError: If any field on `info` is not of the correct type.
  
    Returns:
      A string representation of the provided `TensorBoardInfo`.