docs: def _write_ini(source_dict, namespace_name=None, level=0, indent_size=4,
                     output_stream=sys.stdout):
          """this function prints the components of a configobj ini file.  It is
          recursive for outputing the nested sections of the ini file."""
          options = [
              value
              for value in source_dict.values()
              if isinstance(value, Option)
          ]
          options.sort(key=lambda x: x.name)
          indent_spacer = " " * (level * indent_size)
          for an_option in options:
              print("%s# %s" % (indent_spacer, an_option.doc),
                    file=output_stream)
              option_value = to_str(an_option)
  
              if an_option.reference_value_from:
                  print(
                      '%s# see "%s.%s" for the default or override it here' % (
                          indent_spacer,
                          an_option.reference_value_from,
                          an_option.name
                      ),
                      file=output_stream
                  )
  
              if an_option.likely_to_be_changed or an_option.has_changed:
                  option_format = '%s%s=%s\n'
              else:
                  option_format = '%s#%s=%s\n'
  
              if isinstance(option_value, six.string_types) and \
                      ',' in option_value:
                  # quote lists unless they're already quoted
                  if option_value[0] not in '\'"':
                      option_value = '"%s"' % option_value
  
              print(option_format % (indent_spacer, an_option.name,
                                     option_value),
                    file=output_stream)
          next_level = level + 1
          namespaces = [
              (key, value)
              for key, value in source_dict.items()
              if isinstance(value, Namespace)
          ]
          namespaces.sort(key=ValueSource._namespace_reference_value_from_sort)
          for key, namespace in namespaces:
              next_level_spacer = " " * next_level * indent_size
              print("%s%s%s%s\n" % (indent_spacer, "[" * next_level, key,
                                    "]" * next_level),
                    file=output_stream)
              if namespace._doc:
                  print("%s%s" % (next_level_spacer, namespace._doc),
                        file=output_stream)
              if namespace._reference_value_from:
                  print("%s#+include ./common_%s.ini\n"
                        % (next_level_spacer, key), file=output_stream)
  
              if namespace_name:
                  ValueSource._write_ini(
                      source_dict=namespace,
                      namespace_name="%s.%s" % (namespace_name, key),
                      level=level+1,
                      indent_size=indent_size,
                      output_stream=output_stream
                  )
              else:
                  ValueSource._write_ini(
                      source_dict=namespace,
                      namespace_name=key,
                      level=level+1,
                      indent_size=indent_size,
                      output_stream=output_stream
                  )