Returns the result of a Tesseract OCR run on the provided image to pdf/hocr

def image_to_pdf_or_hocr(image,
                    lang=None,
                    config='',
                    nice=0,
                    extension='pdf'):
    '''
    Returns the result of a Tesseract OCR run on the provided image to pdf/hocr
    '''

    if extension not in {'pdf', 'hocr'}:
        raise ValueError('Unsupported extension: {}'.format(extension))
    args = [image, extension, lang, config, nice, True]

    return run_and_get_output(*args)