code: def get_array(
      mesh, name, preference="cell", err=False
  ) -> Optional["pyvista.ndarray"]:
      """Search point, cell and field data for an array.
  
      Parameters
      ----------
      mesh : pyvista.DataSet
          Dataset to get the array from.
  
      name : str
          The name of the array to get the range.
  
      preference : str, default: "cell"
          When scalars is specified, this is the preferred array type to
          search for in the dataset.  Must be either ``'point'``,
          ``'cell'``, or ``'field'``.
  
      err : bool, default: False
          Whether to throw an error if array is not present.
  
      Returns
      -------
      pyvista.pyvista_ndarray or None
          Requested array.  Return ``None`` if there is no array
          matching the ``name`` and ``err=False``.
  
      """
      if isinstance(mesh, _vtk.vtkTable):
          arr = row_array(mesh, name)
          if arr is None and err:
              raise KeyError(
                  f"Data array ({name}) not present in this dataset."
              )
          return arr
  
      if not isinstance(preference, str):
          raise TypeError("`preference` must be a string")
      if preference not in ["cell", "point", "field"]:
          raise ValueError(
              f'`preference` must be either "cell", "point", "field" for a '
              f'{type(mesh)}, not "{preference}".'
          )
  
      parr = point_array(mesh, name)
      carr = cell_array(mesh, name)
      farr = field_array(mesh, name)
      preference = parse_field_choice(preference)
      if sum([array is not None for array in (parr, carr, farr)]) > 1:
          if preference == FieldAssociation.CELL:
              return carr
          elif preference == FieldAssociation.POINT:
              return parr
          else:  # must be field
              return farr
  
      if parr is not None:
          return parr
      elif carr is not None:
          return carr
      elif farr is not None:
          return farr
      elif err:
          raise KeyError(
              f"Data array ({name}) not present in this dataset."
          )
      return None
  
imports: import collections.abc
  import enum
  from itertools import product
  from typing import Optional, Tuple, Union
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core._typing_core import Matrix, NumpyArray, TransformLike, Vector
  from pyvista.core.errors import AmbiguousDataError, MissingDataError
label_desc: Use image node_id 7 for calling a global function with example usage: get_array(mesh, name, preference, err) and returns: None, arr, parr, carr, carr, parr, farr, farr