def read_minisat_result(result_path):
    """Read the output from minisat.

    Returs one of:
    None -- empty file
    'UNSAT' -- unsatisfiable result
    dict containing the assignment -- satisfiable result
    """
    with open(result_path) as f:
        s = f.read().rstrip()
        head = s.split()[0]
        if len(s) == 0:
            return None
        if s.startswith('UNSAT'):
            return 'UNSAT'
        elif s.startswith('INDET'):
            return 'INDET'
        elif s.startswith('SAT'):
            A = {}
            s = [int(e) for e in s.split()[1:]]
            for e in s:
                if e < 0:
                    A[-e] = False
                else:
                    A[e] = True
            return A
        else:
            raise Exception('Unknown result {}'.format(head))