<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_mv_rule(tensorprod_rule, dim):
 """Convert tensor product rule into a multivariate quadrature generator."""

    def mv_rule(order, sparse=False, part=None):
        """
        Multidimensional integration rule.

        Args:
            order (int, numpy.ndarray) : order of integration rule. If numpy.ndarray,
                order along each axis.
            sparse (bool) : use Smolyak sparse grid.

        Returns:
            (numpy.ndarray, numpy.ndarray) abscissas and weights.
        """
        if sparse:
            order = numpy.ones(dim, dtype=int)*order
            tensorprod_rule_ = lambda order, part=part:\
                tensorprod_rule(order, part=part)
            return chaospy.quad.sparse_grid(tensorprod_rule_, order)

        return tensorprod_rule(order, part=part)

    return mv_rule