def check_integrity(sakefile, settings):
sprint = settings["<STR_LIT>"]<EOL>error = settings["<STR_LIT:error>"]<EOL>sprint("<STR_LIT>", level="<STR_LIT>")<EOL>if not sakefile:<EOL><INDENT>error("<STR_LIT>")<EOL>return False<EOL><DEDENT>if len(sakefile.keys()) != len(set(sakefile.keys())):<EOL><INDENT>error("<STR_LIT>")<EOL>return False<EOL><DEDENT>for target in sakefile:<EOL><INDENT>if target == "<STR_LIT:all>":<EOL><INDENT>if not check_target_integrity(target, sakefile["<STR_LIT:all>"], all=True):<EOL><INDENT>error("<STR_LIT>")<EOL>return False<EOL><DEDENT>continue<EOL><DEDENT>if "<STR_LIT>" not in sakefile[target]:<EOL><INDENT>if not check_target_integrity(target, sakefile[target],<EOL>meta=True):<EOL><INDENT>errmes = "<STR_LIT>".format(target)<EOL>error(errmes)<EOL>return False<EOL><DEDENT>for atom_target in sakefile[target]:<EOL><INDENT>if atom_target == "<STR_LIT>":<EOL><INDENT>continue<EOL><DEDENT>if not check_target_integrity(atom_target,<EOL>sakefile[target][atom_target],<EOL>parent=target):<EOL><INDENT>errmes = "<STR_LIT>".format(<EOL>atom_target)<EOL>error(errmes)<EOL>return False<EOL><DEDENT><DEDENT>continue<EOL><DEDENT>if not check_target_integrity(target, sakefile[target]):<EOL><INDENT>errmes = "<STR_LIT>".format(target)<EOL>error(errmes)<EOL>return False<EOL><DEDENT><DEDENT>return True<EOL>
Checks the format of the sakefile dictionary
to ensure it conforms to specification

Args:
    A dictionary that is the parsed Sakefile (from sake.py)
    The setting dictionary (for print functions)
Returns:
    True if the Sakefile is conformant
    False if not