def npoly_val(params, exponents, x_vals):
    """ Returns the value of an n-variable polynomial at the point given by
        x_vals
    """
    try:
        sum_of_terms = 0
        for i, param in enumerate(params):
            term = param
            for j, x in enumerate(x_vals):
                term = term * pow(x, exponents[i][j])
            sum_of_terms += term
        return sum_of_terms
    except:
        raise ValueError('exponents: {}; i = {}; j = {}; xdata = {}'.format
            (exponents, i, j, x_vals))
