code: def resolve_deps(base_dir, file_index):
    
    def flatten(tree, index = {}):
      for include in tree.get('include', []):
        fname = base_dir + "/" + include
        assert os.path.exists(fname), "File %s does not exist." % fname
        if fname not in index:
          index[fname] = read_spec(fname)
          index.update(flatten(index[fname], file_index))
      return index
    for fname, contents in file_index.items():
      file_index[fname] = read_spec(fname)
      file_index.update(flatten(file_index[fname], file_index))
    return file_index
docs: Given a base directory and an initial set of files, retrieves
    dependencies and adds them to the file_index.