code: def from_meshio(mesh):
      """Convert a ``meshio`` mesh instance to a PyVista mesh.
  
      Parameters
      ----------
      mesh : meshio.Mesh
          A mesh instance from the ``meshio`` library.
  
      Returns
      -------
      pyvista.UnstructuredGrid
          A PyVista unstructured grid representation of the input ``meshio`` mesh.
  
      Raises
      ------
      ImportError
          If the appropriate version of ``meshio`` library is not found.
  
      """
      try:  # meshio<5.0 compatibility
          from meshio.vtk._vtk import (
              meshio_to_vtk_type,
              vtk_type_to_numnodes,
          )
      except ImportError:  # pragma: no cover
          from meshio._vtk_common import meshio_to_vtk_type
          from meshio.vtk._vtk_42 import vtk_type_to_numnodes
  
      # Extract cells from meshio.Mesh object
      cells = []
      cell_type = []
      for c in mesh.cells:
          vtk_type = meshio_to_vtk_type[c.type]
          numnodes = vtk_type_to_numnodes[vtk_type]
          fill_values = np.full(
              (len(c.data), 1), numnodes, dtype=c.data.dtype
          )
          cells.append(np.hstack((fill_values, c.data)).ravel())
          cell_type += [vtk_type] * len(c.data)
  
      # Extract cell data from meshio.Mesh object
      cell_data = {
          k: np.concatenate(v) for k, v in mesh.cell_data.items()
      }
  
      # Create pyvista.UnstructuredGrid object
      points = mesh.points
  
      # convert to 3D if points are 2D
      if points.shape[1] == 2:
          zero_points = np.zeros((len(points), 1), dtype=points.dtype)
          points = np.hstack((points, zero_points))
  
      grid = pyvista.UnstructuredGrid(
          np.concatenate(cells).astype(np.int64, copy=False),
          np.array(cell_type),
          np.array(points, np.float64),
      )
  
      # Set point data
      grid.point_data.update(
          {
              k: np.array(v, np.float64)
              for k, v in mesh.point_data.items()
          }
      )
  
      # Set cell data
      grid.cell_data.update(cell_data)
  
      # Call datatype-specific post-load processing
      grid._post_file_load_processing()
  
      return grid
  
imports: import os
  import pathlib
  import warnings
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core.errors import PyVistaDeprecationWarning
  from .observers import Observer
label_desc: Use image node_id 10 for calling a global function with example usage: from_meshio(mesh) and returns: grid