code: def getLayerIndex(self, layer):
                        
          for i in range(len(self.layers)):
              if layer == self.layers[i]: # shallow cmp
                  return i
          return -1 # not in list
docs: Given a reference to a layer, returns the index of that layer in
          self.layers.