def _assert_AB_consistent(A, B):
    assert ((len(A.shape) == 2) and (A.shape[0] == A.shape[1]))
    assert (len(B.shape) == 2)
    assert (A.shape[0] == B.shape[0])
def _assert_AB_consistent(A, B):
    assert ((len(A.shape) == 2) and (A.shape[0] == A.shape[1]))
    assert (len(B.shape) == 2)
    assert (A.shape[0] == B.shape[0])