'Send the console output for the given instance.'

@messaging.expected_exceptions(NotImplementedError, exception.ConsoleNotAvailable, exception.InstanceNotFound)
@wrap_exception()
@wrap_instance_fault
def get_console_output(self, context, instance, tail_length):

    context = context.elevated()
    LOG.info('Get    console    output', instance=instance)
    output = self.driver.get_console_output(context, instance)
    if (type(output) is six.text_type):
        output = six.b(output)
    if (tail_length is not None):
        output = self._tail_log(output, tail_length)
    return output.decode('ascii', 'replace')
