docstr: Convert HOCON input into a YAML output
  
  :return: YAML string representation
  :type return: basestring
docstr_tok: ["Convert","HOCON","input","into","a","YAML","output",":","return",":","YAML","string","representation",":","type","return",":","basestring"]
code: def to_yaml(cls, config, compact=False, indent=2, level=0):
      """Convert HOCON input into a YAML output
  
      :return: YAML string representation
      :type return: basestring
      """
      lines = ""
      if isinstance(config, ConfigTree):
          if len(config) > 0:
              if level > 0:
                  lines += "\n"
              bet_lines = []
              for key, item in config.items():
                  bet_lines.append(
                      "{indent}{key}: {value}".format(
                          indent="".rjust(level * indent, " "),
                          key=key.strip(
                              '"'
                          ),  # for dotted keys enclosed with "" to not be interpreted as nested key,
                          value=cls.to_yaml(
                              item, compact, indent, level + 1
                          ),
                      )
                  )
              lines += "\n".join(bet_lines)
      elif isinstance(config, list):
          config_list = [line for line in config if line is not None]
          if len(config_list) == 0:
              lines += "[]"
          else:
              lines += "\n"
              bet_lines = []
              for item in config_list:
                  bet_lines.append(
                      "{indent}- {value}".format(
                          indent="".rjust(level * indent, " "),
                          value=cls.to_yaml(
                              item, compact, indent, level + 1
                          ),
                      )
                  )
              lines += "\n".join(bet_lines)
      elif isinstance(config, basestring):
          # if it contains a \n then it's multiline
          lines = config.split("\n")
          if len(lines) == 1:
              lines = config
          else:
              lines = "|\n" + "\n".join(
                  [line.rjust(level * indent, " ") for line in lines]
              )
      elif config is None or isinstance(config, NoneValue):
          lines = "null"
      elif config is True:
          lines = "true"
      elif config is False:
          lines = "false"
      else:
          lines = str(config)
      return lines
  
file_path: clearml/clearml/utilities/pyhocon/converter.py
imports: import json
  import re
  import sys
  from .None import ConfigFactory
  from .config_tree import ConfigQuotedString
  from .config_tree import ConfigSubstitution
  from .config_tree import ConfigTree
  from .config_tree import ConfigValues
  from .config_tree import NoneValue
label_desc: Use image node_id 4 for calling the HOCONConverter obj's underlying member method code with example usage: obj.to_yaml(cls, config, compact, indent, level) and returns: lines