def merge_train_and_val(train, val):
    """
    Takes two SleepStudyDataset objects 'train' and 'val' and merges them by
    adding all stored SleepStudy pairs of 'val' to the list of pairs in 'train'
    Then changes the 'identifier' attribute of the 'train' sequencer to reflect
    the changes and returns the, now merged, 'train' dataset only (in a list).

    Args:
        train: A SleepStudyDataset object
        val:   A SleepStudyDataset object

    Returns:
        A list of 1 SleepStudyDataset object storing data from both 'train'
        and 'val'
    """
    train.pairs.extend(val.pairs)
    train._identifier = train.identifier + "_" + val.identifier.split("/")[-1]
    train.log()
    return [train]