def add(self, model):
        """raises an exception if the model cannot be added"""
        def foo(m, p, i):
            if m[i][0].name == model.name:
                raise ValueError("Model already exists")
            return
        # checks if already existing
        self.foreach(foo)
        
        self.append((model,))
        return
def add ( self , model ) : def foo ( m , p , i ) : if m [ i ] [ 0 ] . name == model . name : raise ValueError ( "Model already exists" ) return self . foreach ( foo ) self . append ( ( model , ) ) return
raises an exception if the model cannot be added