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: Find entries in event dict.
docstr_tok: ["Find","entries","in","event","dict","."]
code: def _keys_to_idx(self, keys):
      """Find entries in event dict."""
      from ..event import match_event_names  # avoid circular import
  
      keys = keys if isinstance(keys, (list, tuple)) else [keys]
      try:
          # Assume it's a condition name
          return np.where(
              np.any(
                  np.array(
                      [
                          self.events[:, 2] == self.event_id[k]
                          for k in match_event_names(
                              self.event_id, keys
                          )
                      ]
                  ),
                  axis=0,
              )
          )[0]
      except KeyError as err:
          # Could we in principle use metadata with these Epochs and keys?
          if len(keys) != 1 or self.metadata is None:
              # If not, raise original error
              raise
          msg = str(err.args[0])  # message for KeyError
          pd = _check_pandas_installed(strict=False)
          # See if the query can be done
          if pd:
              md = self.metadata if hasattr(self, "_metadata") else None
              self._check_metadata(metadata=md)
              try:
                  # Try metadata
                  vals = (
                      self.metadata.reset_index()
                      .query(keys[0], engine="python")
                      .index.values
                  )
              except Exception as exp:
                  msg += (
                      " The epochs.metadata Pandas query did not "
                      "yield any results: %s" % (exp.args[0],)
                  )
              else:
                  return vals
          else:
              # If not, warn this might be a problem
              msg += (
                  " The epochs.metadata Pandas query could not "
                  "be performed, consider installing Pandas."
              )
          raise KeyError(msg)
  
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 4 for calling the GetEpochsMixin obj's underlying member method code with example usage: obj._keys_to_idx(keys) and returns: np, vals