'Return a canvas that is suitable for saving figures to a specified
file format. If necessary, this function will switch to a registered
backend that supports the format.'

def _get_output_canvas(self, format):

    method_name = (u'print_%s' % format)
    if hasattr(self, method_name):
        return self
    canvas_class = get_registered_canvas_class(format)
    if canvas_class:
        return self.switch_backends(canvas_class)
    formats = sorted(self.get_supported_filetypes())
    raise ValueError((u'Format    "%s"    is    not    supported.\nSupported    formats:    %s.' % (format, u',    '.join(formats))))
