2D comparision pycode