def download(dataset, version='latest', redownload=False):
    dataset = dataset.lower()
    if dataset.startswith('pdc'):
        box_token = get_box_token()
        if (dataset != 'pdcbrca'):
            mapping = cptac.download(dataset, version=version, redownload=redownload, _box_auth=True, _box_token=box_token)
            omics = _pdc_download(dataset, version=version, redownload=redownload)
            if (omics and mapping):
                return True
            else:
                return False
        else:
            omics = _pdc_download(dataset, version=version, redownload=redownload)
            if omics:
                return True
            else:
                return False
    elif (dataset.startswith('pancan') or (dataset == 'all')):
        box_token = get_box_token()
        if (dataset == 'pancanbrca'):
            sources = BRCA_SOURCES
        elif (dataset == 'pancanccrcc'):
            sources = CCRCC_SOURCES
        elif (dataset == 'pancancoad'):
            sources = COAD_SOURCES
        elif (dataset == 'pancangbm'):
            sources = GBM_SOURCES
        elif (dataset == 'pancanhnscc'):
            sources = HNSCC_SOURCES
        elif (dataset == 'pancanlscc'):
            sources = LSCC_SOURCES
        elif (dataset == 'pancanluad'):
            sources = LUAD_SOURCES
        elif (dataset == 'pancanov'):
            sources = OV_SOURCES
        elif (dataset == 'pancanucec'):
            sources = UCEC_SOURCES
        elif (dataset == 'pancanpdac'):
            sources = PDAC_SOURCES
        elif (dataset == 'all'):
            sources = sorted(set((((((((((BRCA_SOURCES + CCRCC_SOURCES) + COAD_SOURCES) + GBM_SOURCES) + HNSCC_SOURCES) + LSCC_SOURCES) + LUAD_SOURCES) + OV_SOURCES) + UCEC_SOURCES) + PDAC_SOURCES)))
        else:
            raise InvalidParameterError(f'{dataset} is not a valid dataset.')
        overall_success = True
        for source in sources:
            if source.startswith('pdc'):
                single_success = download(source, version=version, redownload=redownload)
            else:
                single_success = cptac.download(source, version=version, redownload=redownload, _box_auth=True, _box_token=box_token)
            if (not single_success):
                overall_success = False
        return overall_success
    else:
        return cptac.download(dataset, version=version, redownload=redownload, _box_auth=True)
def download(dataset, version='latest', redownload=False):
    dataset = dataset.lower()
    if dataset.startswith('pdc'):
        box_token = get_box_token()
        if (dataset != 'pdcbrca'):
            mapping = cptac.download(dataset, version=version, redownload=redownload, _box_auth=True, _box_token=box_token)
            omics = _pdc_download(dataset, version=version, redownload=redownload)
            if (omics and mapping):
                return True
            else:
                return False
        else:
            omics = _pdc_download(dataset, version=version, redownload=redownload)
            if omics:
                return True
            else:
                return False
    elif (dataset.startswith('pancan') or (dataset == 'all')):
        box_token = get_box_token()
        if (dataset == 'pancanbrca'):
            sources = BRCA_SOURCES
        elif (dataset == 'pancanccrcc'):
            sources = CCRCC_SOURCES
        elif (dataset == 'pancancoad'):
            sources = COAD_SOURCES
        elif (dataset == 'pancangbm'):
            sources = GBM_SOURCES
        elif (dataset == 'pancanhnscc'):
            sources = HNSCC_SOURCES
        elif (dataset == 'pancanlscc'):
            sources = LSCC_SOURCES
        elif (dataset == 'pancanluad'):
            sources = LUAD_SOURCES
        elif (dataset == 'pancanov'):
            sources = OV_SOURCES
        elif (dataset == 'pancanucec'):
            sources = UCEC_SOURCES
        elif (dataset == 'pancanpdac'):
            sources = PDAC_SOURCES
        elif (dataset == 'all'):
            sources = sorted(set((((((((((BRCA_SOURCES + CCRCC_SOURCES) + COAD_SOURCES) + GBM_SOURCES) + HNSCC_SOURCES) + LSCC_SOURCES) + LUAD_SOURCES) + OV_SOURCES) + UCEC_SOURCES) + PDAC_SOURCES)))
        else:
            raise InvalidParameterError(f'{dataset} is not a valid dataset.')
        overall_success = True
        for source in sources:
            if source.startswith('pdc'):
                single_success = download(source, version=version, redownload=redownload)
            else:
                single_success = cptac.download(source, version=version, redownload=redownload, _box_auth=True, _box_token=box_token)
            if (not single_success):
                overall_success = False
        return overall_success
    else:
        return cptac.download(dataset, version=version, redownload=redownload, _box_auth=True)