def compareDatasets(test, train):
    """
    Compare training and testing datasets
    Parameters:
    - test   -- dictionary defining test dataset
    - train  -- dictionary defining training dataset
    Returns:
    - minimal value of test fraction of samples
    - maximal value of test fraction of samples
    - number of errors found
    """
    _max_test = 0
    _min_test = 1.0
    _n_errors = 0
    for _p, _test_sols in test.items():
        try:
            _train_sols = train[_p]
            _common_sols = _test_sols & _train_sols
            if _common_sols:
                print(f"Error: common solutions of problem {_p} in test and train datasets")
                _n_errors +=1
            _test_part = float(len(_test_sols)) / float(len(_train_sols))
            _max_test = max(_max_test, _test_part)
            _min_test = min(_min_test, _test_part)
        except KeyError:
            print(f"Problem {_p} is only in test dataset but not in training one")
            _n_errors +=1
    for _p, _sols in train.items():
        if _p not in test:
            print(f"Problem {_p} is only in training dataset but not in test one")
            _n_errors +=1
    return _min_test, _max_test, _n_errors