def _evaluate_barycentric(nodes, degree, lambda1, lambda2, lambda3):
    r"""Compute a point on a surface.

    Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)` for a
    B |eacute| zier surface / triangle defined by ``nodes``.

    .. note::

       There is also a Fortran implementation of this function, which
       will be used if it can be built.

    Args:
        nodes (numpy.ndarray): Control point nodes that define the surface.
        degree (int): The degree of the surface define by ``nodes``.
        lambda1 (float): Parameter along the reference triangle.
        lambda2 (float): Parameter along the reference triangle.
        lambda3 (float): Parameter along the reference triangle.

    Returns:
        numpy.ndarray: The evaluated point as a ``D x 1`` array (where ``D``
        is the ambient dimension where ``nodes`` reside).
    """
    dimension, num_nodes = nodes.shape
    binom_val = 1.0
    result = np.zeros((dimension, 1), order="F")
    index = num_nodes - 1
    result[:, 0] += nodes[:, index]
    # curve evaluate_multi_barycentric() takes arrays.
    lambda1 = np.asfortranarray([lambda1])
    lambda2 = np.asfortranarray([lambda2])
    for k in six.moves.xrange(degree - 1, -1, -1):
        # We want to go from (d C (k + 1)) to (d C k).
        binom_val = (binom_val * (k + 1)) / (degree - k)
        index -= 1  # Step to last element in column.
        #     k = d - 1, d - 2, ...
        # d - k =     1,     2, ...
        # We know column k has (d - k + 1) elements.
        new_index = index - degree + k  # First element in column.
        col_nodes = nodes[:, new_index : index + 1]  # noqa: E203
        col_nodes = np.asfortranarray(col_nodes)
        col_result = _curve_helpers.evaluate_multi_barycentric(
            col_nodes, lambda1, lambda2
        )
        result *= lambda3
        result += binom_val * col_result
        # Update index for next iteration.
        index = new_index
    return result
r"""Compute a point on a surface.

    Evaluates :math:`B\left(\lambda_1, \lambda_2, \lambda_3\right)` for a
    B |eacute| zier surface / triangle defined by ``nodes``.

    .. note::

       There is also a Fortran implementation of this function, which
       will be used if it can be built.

    Args:
        nodes (numpy.ndarray): Control point nodes that define the surface.
        degree (int): The degree of the surface define by ``nodes``.
        lambda1 (float): Parameter along the reference triangle.
        lambda2 (float): Parameter along the reference triangle.
        lambda3 (float): Parameter along the reference triangle.

    Returns:
        numpy.ndarray: The evaluated point as a ``D x 1`` array (where ``D``
        is the ambient dimension where ``nodes`` reside).