<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def check(self):
        "Checks EPUB integrity"
        config = self.load_config()
        if not check_dependency_epubcheck():
            sys.exit(error('Unavailable command.'))
        epub_file = u"%s.epub" % config['fileroot']
        epub_path = join(CWD, 'build', epub_file)
        print success("Starting to check %s..." % epub_file)
        epubcheck = u'epubcheck %s' % epub_path
        epubcheck = shell(epubcheck.encode())
        for line in epubcheck.errors():
            print error(line)
        for line in epubcheck.output():
            print line