def EncodeYaml(param, yaml_key=None):
  """Encode parameter data in yaml format."""
  if yaml_key:
    yaml_string = '%s: ' % yaml_key
  else:
    yaml_string = ''
  yaml_string += param.ToYaml()

  return yaml_string