def retrieve_train_test_instances(cases, train_indices, test_indices):
    """
    Retrieves training and test cases from indices for hpo.

    Parameters
    ----------
    cases : list of dicts, where single dict represents a case
        Cases of the training set of the event log.
    train_indices : list of ints
        Indices of training cases for hpo.
    test_indices : list of ints
        Indices of test cases for hpo.

    Returns
    -------
    train_cases : list of dicts, where single dict represents a case
        Training cases for hpo.
    test_cases : list of dicts, where single dict represents a case
        Test cases for hpo.

    """

    train_cases = []
    test_cases = []

    for idx in train_indices:
        train_cases.append(cases[idx])

    for idx in test_indices:
        test_cases.append(cases[idx])

    return train_cases, test_cases