':param datafile: The datafile to be written.
:type datafile: :py:class:`~robot.parsing.model.TestCaseFile`,
:py:class:`~robot.parsing.model.ResourceFile`,
:py:class:`~robot.parsing.model.TestDataDirectory`
:param str format: Output file format. If omitted, read from the
extension of the `source` attribute of the given `datafile`.
:param output: An open, file-like object used in writing. If
omitted, value of `source` attribute of the given `datafile` is
used to construct a new file object.
:param bool pipe_separated: Whether to use pipes as separator when
output file format is txt.
:param int txt_separating_spaces: Number of separating spaces between
cells in space separated format.
:param str line_separator: Line separator used in output files.
If `output` is not given, an output file is created based on the source
of the given datafile and value of `format`. Examples:
Write output in a StringIO instance using format of `datafile.source`::
WriteConfiguration(datafile, output=StringIO)
Output file is created from `datafile.source` by stripping extension
and replacing it with `html`::
WriteConfiguration(datafile, format=\'html\')'

def __init__(self, datafile, format='', output=None, pipe_separated=False, txt_separating_spaces=4, line_separator='\n'):

    self.datafile = datafile
    self.pipe_separated = pipe_separated
    self.line_separator = line_separator
    self._given_output = output
    self.format = (self._validate_format(format) or self._format_from_file())
    self.txt_separating_spaces = txt_separating_spaces
    self.output = output
