Error on this line It should be: if (abs(p1.freq-p2.freq)<=120 and (p1.bw==500 or p2.bw==500)):
if (abs(p1.freq-p2.freq)<=120 and (p1.bw==500 or p2.bw==500)):