<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_detection_dataset(folder, dataset_filename, sender_known=True):
 """Builds signature detection dataset using emails from folder. folder should have the following structure: x-- folder | x-- P | | | -- positive sample email 1 | | | -- positive sample email 2 | x-- N | | | -- negative sample email 1 | | | -- negative sample email 2 If the dataset file already exist it is rewritten. """

    if os.path.exists(dataset_filename):
        os.remove(dataset_filename)
    build_detection_class(os.path.join(folder, u'P'),
                          dataset_filename, 1)
    build_detection_class(os.path.join(folder, u'N'),
                          dataset_filename, -1)