'Save the model to filename (model must not be None).'

def save(self, filename):

    assert (self.model is not None)
    try:
        with open(filename, 'wb') as f:
            pickle.dump(self.model, f)
    except pickle.PicklingError:
        raise
    except os.error:
        raise
    else:
        self._remember(filename)
