':param mode: One of the variant modes, as specified by the user
:param matrix: The form select/radio matrix'

def _get_variants_count(self, matrix, mode):

    if (mode in [MODE_T, MODE_B]):
        return 1
    elif (mode == MODE_TB):
        return 2
    else:
        len_fun = ((lambda x: min(len(x), 3)) if (mode == MODE_TMB) else len)
        return reduce(operator.mul, map(len_fun, matrix))
