def save_new_notebook(self, data, name=None, format=u'<STR_LIT>'):
if format not in self.allowed_formats:<EOL><INDENT>raise web.HTTPError(<NUM_LIT>, u'<STR_LIT>' % format)<EOL><DEDENT>try:<EOL><INDENT>nb = current.reads(data.decode('<STR_LIT:utf-8>'), format)<EOL><DEDENT>except:<EOL><INDENT>raise web.HTTPError(<NUM_LIT>, u'<STR_LIT>')<EOL><DEDENT>if name is None:<EOL><INDENT>try:<EOL><INDENT>name = nb.metadata.name<EOL><DEDENT>except AttributeError:<EOL><INDENT>raise web.HTTPError(<NUM_LIT>, u'<STR_LIT>')<EOL><DEDENT><DEDENT>nb.metadata.name = name<EOL>notebook_id = self.new_notebook_id(name)<EOL>self.save_notebook_object(notebook_id, nb)<EOL>return notebook_id<EOL>
Save a new notebook and return its notebook_id.

        If a name is passed in, it overrides any values in the notebook data
        and the value in the data is updated to use that value.