@classmethod
def check_form_match(cls, tensor1=None, tensor2=None, qhape1=None, shape1=
    None, dirs1=None, qhape2=None, shape2=None, dirs2=None, qodulus=None):
    """Check that the given two tensors have the same form in the sense
        that, i.e. that their indices have the same dimensions. Instead of
        giving two tensors, two shapes can also be given.
        """
    if tensor1 is not None:
        shape1 = tensor1.shape
    if tensor2 is not None:
        shape2 = tensor2.shape
    return shape1 == shape2
