code: def check_so2_matrix_shape(matrix: Tensor) -> None:
      matrix_shape = matrix.shape
      len_matrix_shape = len(matrix_shape)
      if (
          (
              len_matrix_shape == 3
              and (matrix_shape[1] != 2 or matrix_shape[2] != 2)
          )
          or (
              len_matrix_shape == 2
              and (matrix_shape[0] != 2 or matrix_shape[1] != 2)
          )
          or (len_matrix_shape > 3 or len_matrix_shape < 2)
      ):
          raise ValueError(
              f"Invalid input size, we expect [B, 2, 2] or [2, 2]. Got: {matrix_shape}"
          )
  
file_path: kornia/kornia/geometry/liegroup/_utils.py
imports: from kornia.core import Tensor
label_desc: Use image node_id 4 for calling a global function with example usage: check_so2_matrix_shape(matrix) without return types