def _handle_condition_ids(condition_ids, condition_to_index, num_responses):
    """
    Returns condition_ids preprocessed to match the shape of responses batch.
    Specifically:
        If condition_ids is None it is replaced with default condition index repeated num_responses times.
        If condition_ids is an one index, it is repeated num_responses times.
        If condition_ids is an array, assert that the shape is right.
    """
    if condition_ids is None:
        return np.array([condition_to_index[DEFAULT_CONDITION]] * num_responses, dtype=INTX)

    condition_ids = np.array(condition_ids, dtype=INTX)
    if len(condition_ids.shape) == 0:  # If condition_ids is one number
        return np.repeat(condition_ids[np.newaxis], num_responses, axis=0)
    elif condition_ids.shape != (num_responses, ):
        raise ValueError('Shape of condition_ids is {} and is not equal to (num_resonses, )={}'.format(
            condition_ids.shape, (num_responses, )))
    else:
        return condition_ids

    Returns condition_ids preprocessed to match the shape of responses batch.
    Specifically:
        If condition_ids is None it is replaced with default condition index repeated num_responses times.
        If condition_ids is an one index, it is repeated num_responses times.
        If condition_ids is an array, assert that the shape is right.
    
cakechat/dialog_model/inference/utils.py