'Create a new spawner'

def _new_spawner(self, name, spawner_class=None, **kwargs):

    if (spawner_class is None):
        spawner_class = self.spawner_class
    self.log.debug('Creating    %s    for    %s:%s', spawner_class, self.name, name)
    orm_spawner = self.orm_spawners.get(name)
    if (orm_spawner is None):
        orm_spawner = orm.Spawner(user=self.orm_user, name=name)
        self.db.add(orm_spawner)
        self.db.commit()
        assert (name in self.orm_spawners)
    if ((name == '') and self.state):
        orm_spawner.state = self.state
        self.state = None
    spawn_kwargs = dict(user=self, orm_spawner=orm_spawner, hub=self.settings.get('hub'), authenticator=self.authenticator, config=self.settings.get('config'), proxy_spec=url_path_join(self.proxy_spec, name, '/'))
    spawn_kwargs.update(kwargs)
    spawner = spawner_class(**spawn_kwargs)
    spawner.load_state((orm_spawner.state or {}))
    return spawner
