def motifScoreCmp(motifOcc1, motifOcc2):
    """Compares two motif occurences according to their pval."""

    if (motifOcc1.getPval() < motifOcc2.getPval()):
        return -1
    elif (motifOcc1.getPval() == motifOcc2.getPval()):
        return 0
    else:
        assert (motifOcc1.getPval() > motifOcc2.getPval())
        return 1