class_docstr: Class to add epoch selection and metadata to certain classes.
class_docstr_tok: ["Class","to","add","epoch","selection","and","metadata","to","certain","classes","."]
docstr: Check metadata consistency.
docstr_tok: ["Check","metadata","consistency","."]
code: def _check_metadata(self, metadata=None, reset_index=False):
      """Check metadata consistency."""
      # reset_index=False will not copy!
      if metadata is None:
          return
      else:
          pd = _check_pandas_installed(strict=False)
          if pd:
              _validate_type(
                  metadata, types=pd.DataFrame, item_name="metadata"
              )
              if len(metadata) != len(self.events):
                  raise ValueError(
                      "metadata must have the same number of "
                      "rows (%d) as events (%d)"
                      % (len(metadata), len(self.events))
                  )
              if reset_index:
                  if hasattr(self, "selection"):
                      # makes a copy
                      metadata = metadata.reset_index(drop=True)
                      metadata.index = self.selection
                  else:
                      metadata = deepcopy(metadata)
          else:
              _validate_type(metadata, types=list, item_name="metadata")
              if reset_index:
                  metadata = deepcopy(metadata)
      return metadata
  
imports: import json
  import logging
  from collections import OrderedDict
  from copy import deepcopy
  import numpy
  from ._logging import verbose, warn
  from .check import _check_pandas_installed, _check_preload, _validate_type
  from .numerics import _time_mask, object_hash, object_size
label_desc: Use image node_id 9 for calling the GetEpochsMixin obj's underlying member method code with example usage: obj._check_metadata(metadata, reset_index) and returns: metadata