code: def merge(
      datasets,
      merge_points=True,
      main_has_priority=True,
      progress_bar=False,
  ):
      """Merge several datasets.
  
      .. note::
         The behavior of this filter varies from the
         :func:`PolyDataFilters.boolean_union` filter. This filter
         does not attempt to create a manifold mesh and will include
         internal surfaces when two meshes overlap.
  
      Parameters
      ----------
      datasets : sequence[:class:`pyvista.Dataset`]
          Sequence of datasets. Can be of any :class:`pyvista.Dataset`.
  
      merge_points : bool, default: True
          Merge equivalent points when ``True``.
  
      main_has_priority : bool, default: True
          When this parameter is ``True`` and ``merge_points=True``, the arrays
          of the merging grids will be overwritten by the original main mesh.
  
      progress_bar : bool, default: False
          Display a progress bar to indicate progress.
  
      Returns
      -------
      pyvista.DataSet
          :class:`pyvista.PolyData` if all items in datasets are
          :class:`pyvista.PolyData`, otherwise returns a
          :class:`pyvista.UnstructuredGrid`.
  
      Examples
      --------
      Merge two polydata datasets.
  
      >>> import pyvista as pv
      >>> sphere = pv.Sphere(center=(0, 0, 1))
      >>> cube = pv.Cube()
      >>> mesh = pv.merge([cube, sphere])
      >>> mesh.plot()
  
      """
      if not isinstance(datasets, collections.abc.Sequence):
          raise TypeError(
              f"Expected a sequence, got {type(datasets).__name__}"
          )
  
      if len(datasets) < 1:
          raise ValueError("Expected at least one dataset.")
  
      first = datasets[0]
      if not isinstance(first, pyvista.DataSet):
          raise TypeError(
              f"Expected pyvista.DataSet, not {type(first).__name__}"
          )
  
      return datasets[0].merge(
          datasets[1:],
          merge_points=merge_points,
          main_has_priority=main_has_priority,
          progress_bar=progress_bar,
      )
  
file_path: pyvista/pyvista/core/utilities/features.py
imports: import collections.abc
  import os
  import sys
  from typing import Sequence
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from .helpers import wrap
label_desc: Use image node_id 8 for calling a global function with example usage: merge(datasets, merge_points, main_has_priority, progress_bar) and returns: datasets