Creating script that compares layers

Hello everyone, I am new to creating scripts in python for 3D Slicer and I was wondering if anyone knew how to go about creating a script that could compare separate layers of already prepared drawn mask and compare the changes of the bone from one layer to another. Any help would be appreciated and also please excuse me if this topic is not the clearest there is.