'Runs tidy in the operating system and returns output.'

def run_tidy(self, options, input, output=None, tidy=None):

    command = (tidy or self._tidy)[:]
    if options:
        command.extend([e.decode('utf8') for e in split(options.encode('utf8'))])
    command.append(self._path(input))
    if output:
        command.append(output)
    print '    '.join(command)
    with tempfile.TemporaryFile() as stdout:
        rc = call(command, stdout=stdout, stderr=STDOUT, cwd=ROBOT_SRC, shell=(os.sep == '\\'))
        stdout.seek(0)
        content = console_decode(stdout.read().strip())
        if rc:
            raise RuntimeError(content)
        return content
