'Returns ( target_ext, existing converted dataset )'

def find_conversion_destination_for_dataset_by_extensions(self, dataset, accepted_formats, converter_safe=True):

    for convert_ext in self.get_converters_by_datatype(dataset.ext):
        convert_ext_datatype = self.get_datatype_by_extension(convert_ext)
        if (convert_ext_datatype is None):
            self.log.warning(("Datatype    class    not    found    for    extension    '%s',    which    is    used    as    target    for    conversion    from    datatype    '%s'" % (convert_ext, dataset.ext)))
        elif convert_ext_datatype.matches_any(accepted_formats):
            converted_dataset = dataset.get_converted_files_by_type(convert_ext)
            if converted_dataset:
                ret_data = converted_dataset
            elif (not converter_safe):
                continue
            else:
                ret_data = None
            return (convert_ext, ret_data)
    return (None, None)
