def choose_condition(data, events, condition):
    """Filters out a specific condition from the data.

    :param data: data from which to extract conditions from
    :type data: numpy array
    :param events: event data of shape [trials x 4]
    :type events: numpy array
    :param condition: Condition to be filtered out of the data.
        Conditions that exist are:
        0 <=> Pronounced Speech
        1 <=> Inner Speech
        2 <=> Visualized Condition
    :type condition: string of integer specifying the condition
    :return: eeg data and event data
    :rtype: tuple of two numpy arrays
    """
    # convert condition to the right format
    if type(condition)==str:
        condition = sorted(condition.replace(' ', '').lower())
        if condition == sorted('pronouncedspeech'):
            condition = 0
        elif condition == sorted('innerspeech'):
            condition = 1
        elif condition == sorted('visualizedcondition'):
            condition = 2
        else:
            raise ValueError("The condition-string you provided is wrong!")
    # filter out every sample with the right condition
    keep_pos = events[:, 2] == condition
    data = data[keep_pos]
    events = events[keep_pos]
    return data, events