code: def get_mixed_cells(vtkobj):
      """Create the cells dictionary from the given pyvista.UnstructuredGrid.
  
      This functions creates a cells dictionary (see
      create_mixed_cells), with a mapping vtk_type -> np.ndarray (int)
      for fixed size cell types. The returned dictionary will have
      arrays of size [N, D], where N is the number of cells and D is the
      size of the cells for the given type (e.g. 3 for triangles).
  
      Parameters
      ----------
      vtkobj : pyvista.UnstructuredGrid
          The unstructured grid for which the cells dictionary should be computed.
  
      Returns
      -------
      dict
          Dictionary of cells.
  
      Raises
      ------
      ValueError
          If vtkobj is not a pyvista.UnstructuredGrid, any of the
          present cells are unsupported, or have dynamic cell sizes,
          like VTK_POLYGON.
      """
      from .cell_type_helper import enum_cell_type_nr_points_map
  
      return_dict = {}
  
      if not isinstance(vtkobj, pyvista.UnstructuredGrid):
          raise ValueError("Expected a pyvista object")
  
      nr_cells = vtkobj.n_cells
      if nr_cells == 0:
          return None
  
      cell_types = vtkobj.celltypes
      cells = vtkobj.cells
  
      unique_cell_types = np.unique(cell_types)
  
      if not np.all(
          [k in enum_cell_type_nr_points_map for k in unique_cell_types]
      ):
          raise ValueError(
              "Found unknown or unsupported VTK cell type in the present cells"
          )
  
      if not np.all(
          [
              enum_cell_type_nr_points_map[k] > 0
              for k in unique_cell_types
          ]
      ):
          raise ValueError(
              "You requested a cell-dictionary with a variable length cell, which is not supported "
              "currently"
          )
  
      cell_sizes = np.zeros_like(cell_types)
      for cell_type in unique_cell_types:
          mask = cell_types == cell_type
          cell_sizes[mask] = enum_cell_type_nr_points_map[cell_type]
  
      cell_ends = np.cumsum(cell_sizes + 1)
      cell_starts = (
          np.concatenate(
              [np.array([0], dtype=cell_ends.dtype), cell_ends[:-1]]
          )
          + 1
      )
  
      for cell_type in unique_cell_types:
          cell_size = enum_cell_type_nr_points_map[cell_type]
          mask = cell_types == cell_type
          current_cell_starts = cell_starts[mask]
  
          cells_inds = current_cell_starts[..., np.newaxis] + np.arange(
              cell_size
          )[np.newaxis].astype(cell_starts.dtype)
  
          return_dict[cell_type] = cells[cells_inds]
  
      return return_dict
  
file_path: pyvista/pyvista/core/utilities/cells.py
imports: from collections import deque
  from itertools import count, islice
  from typing import Tuple, Union
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core._typing_core import Matrix, NumpyArray
label_desc: Use image node_id 4 for calling a global function with example usage: get_mixed_cells(vtkobj) and returns: return_dict, None