I have a question regarding synchronous run of included function. For example, I have the following code.

```
partitions(dataset, num_of_folds, function(train, test, fold) {
  train_and_test(train,test, function(err, results)
  {
  })
})

```

where `partitions` runs `num_of_folds` times, for deffierent fold it returns different train and test sets. I want to run every iteration of partitions only when `train_and_test` is finished. How to do so?