'Take a list of paths and put them into a tree.  Paths with the same prefix should
be at the same level in the tree.
kwargs may be standard jsTree options used at all levels in the tree.  These will be outputted
in the JSON.'

def __init__(self, paths, **kwargs):

    if len(filter((lambda p: (not isinstance(p, Path))), paths)):
        raise TypeError(("All    paths    must    be    instances    of    '%s'" % Path.__name__))
    super(JSTree, self).__init__()
    root = Node('', None, **kwargs)
    for path in sorted(paths):
        curr = root
        subpaths = path.path.split(os.path.sep)
        for (i, subpath) in enumerate(subpaths):
            if (subpath not in curr.children):
                opt = copy.deepcopy(kwargs)
                if ((len(subpaths) - 1) == i):
                    oid = path.id
                    (opt.update(path.options) if (path.options is not None) else None)
                else:
                    oid = None
                curr.children[subpath] = Node(subpath, oid, **opt)
            curr = curr.children[subpath]
    self._items['_root'] = root
