Return the full path for the notebook, given the base path

def full_path(base, fmt):
    """Return the full path for the notebook, given the base path"""
    ext = fmt['extension']
    suffix = fmt.get('suffix')
    prefix = fmt.get('prefix')

    full = base

    if prefix:
        prefix_dir, prefix_file_name = os.path.split(prefix)
        notebook_dir, notebook_file_name = os.path.split(base)

        # Local path separator (\\ on windows)
        sep = base[len(notebook_dir):-len(notebook_file_name)] or '/'
        prefix_dir = prefix_dir.replace('/', sep)

        if prefix_file_name:
            notebook_file_name = prefix_file_name + notebook_file_name

        if prefix_dir:
            # Do not add a path separator when notebook_dir is '/'
            if notebook_dir and not notebook_dir.endswith(sep):
                notebook_dir = notebook_dir + sep
            notebook_dir = notebook_dir + prefix_dir

        if notebook_dir and not notebook_dir.endswith(sep):
            notebook_dir = notebook_dir + sep

        full = notebook_dir + notebook_file_name

    if suffix:
        full = full + suffix

    return full + ext