Implement a custom multidimensional convolution operator in Python without relying on high-level deep learning frameworks.
Implement custom_conv_nd(input_tensor, kernel, stride, padding, dilation). Both tensors are rectangular nested lists with the same number of dimensions. Compute mathematical convolution by reversing the kernel along every axis, using zero-padding, per-axis stride, and dilation. Return the result as a nested list with the appropriate output shape. Do not use NumPy or deep learning libraries.
def custom_conv_nd(input_tensor, kernel, stride, padding, dilation):