def with_script_contents(contents, func):

    def with_file_object(f):
        nbsource = nbformat.writes(contents)
        f.write(nbsource.encode('UTF-8'))
        f.flush()
        func(f.name)
    with_temporary_file(with_file_object)
def with_script_contents(contents, func):

    def with_file_object(f):
        nbsource = nbformat.writes(contents)
        f.write(nbsource.encode('UTF-8'))
        f.flush()
        func(f.name)
    with_temporary_file(with_file_object)