def METHOD_NAME(dataset):
    if isinstance(dataset, LanguagePairDataset):
        return dataset
    if hasattr(dataset, "tgt_dataset"):
        return METHOD_NAME(dataset.tgt_dataset)
    if hasattr(dataset, "dataset"):
        return METHOD_NAME(dataset.dataset)
    raise Exception(f"Don't know how to unwrap this dataset: {dataset}")