def fool_detect_trivial_loop(x):
#
    def halt_test(sprog, inp):
#
        patlength = len("while 0 == 0:")
        foundinfloop = 0
#
        for start in range(0, len(sprog) - patlength):
            if sprog[start : start+patlength] == "while 0 == 0:":
                foundinfloop = 1
#
        return not foundinfloop
#
    if halt_test(x,x):
        while 0 == 0:
            print "Fooled you, I'm looping!"
    else:
        print "Fooled you, I'm halting!"

