<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def changeLayerSize(self, layername, newsize):
 """ Changes layer size. Newsize must be greater than zero. """

        # for all connection from to this layer, change matrix:
        if self.sharedWeights:
            raise AttributeError("shared weights broken")
        for connection in self.connections:
            if connection.fromLayer.name == layername:
                connection.changeSize(  newsize, connection.toLayer.size )
            if connection.toLayer.name == layername:
                connection.changeSize( connection.fromLayer.size, newsize )
        # then, change the actual layer size:
        self.getLayer(layername).changeSize(newsize)