def METHOD_NAME(session, dataset, task):
    old_dataset = session.query(Dataset)\
        .filter(Dataset.task_id == task.id)\
        .filter(Dataset.description == dataset.description).first()
    if old_dataset is not None:
        raise ImportDataError("Dataset \"%s\" already exists."
                              % dataset.description)
    dataset.task = task
    session.add(dataset)
    return dataset