def new_notebook(name=None, metadata=None, worksheets=None):
nb = NotebookNode()<EOL>nb.nbformat = nbformat<EOL>nb.nbformat_minor = nbformat_minor<EOL>if worksheets is None:<EOL><INDENT>nb.worksheets = []<EOL><DEDENT>else:<EOL><INDENT>nb.worksheets = list(worksheets)<EOL><DEDENT>if metadata is None:<EOL><INDENT>nb.metadata = new_metadata()<EOL><DEDENT>else:<EOL><INDENT>nb.metadata = NotebookNode(metadata)<EOL><DEDENT>if name is not None:<EOL><INDENT>nb.metadata.name = unicode(name)<EOL><DEDENT>return nb<EOL>
Create a notebook by name, id and a list of worksheets.