def _validProbabilities(probabilities, task_responses, trial_responses):
    """
    Takes the list of probabilities, valid responses and possible responses and returns the appropriate probabilities
    and responses

    Parameters
    ----------
    probabilities : 1D list or array
        The probabilities for all possible actions
    task_responses : tuple or None
        Provides the action responses expected by the tasks for each
        probability estimate.
    trial_responses : 1D list or array, or ``None``
        The responses allowed for this trial. If ``None`` all are used.

    Returns
    -------
        probabilities : 1D list or array or None
            The probabilities to be evaluated in this trial
        responses: 1D list or None
            The responses associated with each probability

    Examples
    --------
    >>> _validProbabilities([0.2, 0.1, 0.7], ["A", "B", "C"], ["B", "C"])
    ([0.1, 0.7], ['B', 'C'])
    """

    if trial_responses is None:
        responses = task_responses
        reduced_probabilities = probabilities
    else:
        responses = [r for r in task_responses if r in trial_responses]

        if not responses:
            responses = None
            reduced_probabilities = None
        else:
            reduced_probabilities = [probabilities[i] for i, r in enumerate(task_responses) if r in trial_responses]

    return reduced_probabilities, responses