# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import subprocess
import locale
from epubcheck import const as c


def java_version():
    """Call java and return version information.

    :return unicode: Java version string
    """
    result = subprocess.check_output(
        [c.JAVA, '-version'], stderr=subprocess.STDOUT
    )
    first_line = result.splitlines()[0]
    return first_line.decode()


def epubcheck_help():
    """Return epubcheck.jar commandline help text.

    :return unicode: helptext from epubcheck.jar
    """

    tc = locale.getdefaultlocale()[1]

    with open(os.devnull, "w") as devnull:
        p = subprocess.Popen(
            [c.JAVA, '-jar', c.EPUBCHECK, '-h'],
            stdout=subprocess.PIPE,
            stderr=devnull,
        )
        result = p.communicate()[0]

    return result.decode(tc)


def epubcheck_version():
    """Call epubcheck -h and return helptext.

    :return unicode: Epubcheck verstion string
    """
    return epubcheck_help().splitlines()[0]


if __name__ == "__main__":
    print(epubcheck_help())

@@ -89,21 +89,38 @@
 ess%0A
+%0Afrom epubcheck 
 import 
-loca
+samp
 le
+s
 %0Afro
@@ -149,16 +149,56 @@
 st as c%0A
+from epubcheck.checker import EpubCheck%0A
 %0A%0Adef ja
@@ -617,16 +617,18 @@
 %22%22%22%0A%0A   
+ #
  tc = lo
@@ -748,16 +748,38 @@
 %5Bc.JAVA,
+ '-Duser.language=en',
  '-jar',
@@ -935,18 +935,16 @@
 .decode(
-tc
 )%0A%0A%0Adef 
@@ -1112,16 +1112,371 @@
 ()%5B0%5D%0A%0A%0A
+def generate_sample_json():%0A    %22%22%22Generate sample json data for testing%22%22%22%0A%0A    check = EpubCheck(samples.EPUB3_VALID)%0A    with open(samples.RESULT_VALID, 'wb') as jsonfile:%0A        jsonfile.write(check._stdout)%0A%0A    check = EpubCheck(samples.EPUB3_INVALID)%0A    with open(samples.RESULT_INVALID, 'wb') as jsonfile:%0A        jsonfile.write(check._stdout)%0A%0A
 if __nam
@@ -1502,28 +1502,27 @@
     
-print(epubcheck_help()
+generate_sample_json(
 )%0A

add util to generate sample output