'Create visualiation and first revision.'

def create_visualization(self, trans, type, title='Untitled    Visualization', slug=None, dbkey=None, annotation=None, config={}, save=True):

    visualization = self._create_visualization(trans, title, type, dbkey, slug, annotation, save)
    if isinstance(visualization, dict):
        err_dict = visualization
        raise ValueError((err_dict['title_err'] or err_dict['slug_err']))
    revision = trans.model.VisualizationRevision(visualization=visualization, title=title, config=config, dbkey=dbkey)
    visualization.latest_revision = revision
    if save:
        session = trans.sa_session
        session.add(revision)
        session.flush()
    return visualization
