<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def listDatasets(self, dataset="", parent_dataset="", is_dataset_valid=1, release_version="", pset_hash="", app_name="", output_module_label="", global_tag="", processing_version=0, acquisition_era="", run_num=-1, physics_group_name="", logical_file_name="", primary_ds_name="", primary_ds_type="", processed_ds_name="", data_tier_name="", dataset_access_type="VALID", prep_id="", create_by='', last_modified_by='', min_cdate=0, max_cdate=0, min_ldate=0, max_ldate=0, cdate=0, ldate=0, detail=False, dataset_id=-1):
 """ lists all datasets if dataset parameter is not given. The parameter can include % character. all other parameters are not wild card ones. """

        if(logical_file_name and logical_file_name.find("%")!=-1):
            dbsExceptionHandler('dbsException-invalid-input', 'DBSDataset/listDatasets API requires \
                fullly qualified logical_file_name. NO wildcard is allowed in logical_file_name.')
        if(dataset and dataset.find("/%/%/%")!=-1):
            dataset=''
	with self.dbi.connection() as conn:
            dao = (self.datasetbrieflist, self.datasetlist)[detail]
            if dataset_access_type: dataset_access_type = dataset_access_type.upper()
            if data_tier_name: data_tier_name = data_tier_name.upper()
            #if  processing_version:  processing_version =  processing_version.upper()
            #if acquisition_era: acquisition_era = acquisition_era.upper()
            for item in dao.execute(conn, 
                                 dataset, is_dataset_valid,
                                 parent_dataset,
                                 release_version,
                                 pset_hash,
                                 app_name,
                                 output_module_label,
                                 global_tag,
                                 processing_version,
                                 acquisition_era, 
                                 run_num, physics_group_name,
                                 logical_file_name,
                                 primary_ds_name, primary_ds_type,
                                 processed_ds_name, data_tier_name,
                                 dataset_access_type, prep_id, create_by, last_modified_by, 
                                 min_cdate, max_cdate, min_ldate, max_ldate,
                                 cdate, ldate, dataset_id):
	        yield item