code: def _get_metadata(field, expr, metadata_expr, no_metadata_rule):
      """Find the correct metadata expression for the expression.
  
      Parameters
      ----------
      field : {'deltas', 'checkpoints'}
          The kind of metadata expr to lookup.
      expr : Expr
          The baseline expression.
      metadata_expr : Expr, 'auto', or None
          The metadata argument. If this is 'auto', then the metadata table will
          be searched for by walking up the expression tree. If this cannot be
          reflected, then an action will be taken based on the
          ``no_metadata_rule``.
      no_metadata_rule : {'warn', 'raise', 'ignore'}
          How to handle the case where the metadata_expr='auto' but no expr
          could be found.
  
      Returns
      -------
      metadata : Expr or None
          The deltas or metadata table to use.
      """
      if isinstance(metadata_expr, bz.Expr) or metadata_expr is None:
          return metadata_expr
  
      try:
          return expr._child["_".join(((expr._name or ""), field))]
      except (ValueError, AttributeError):
          if no_metadata_rule == "raise":
              raise ValueError(
                  "no %s table could be reflected for %s"
                  % (field, expr)
              )
          elif no_metadata_rule == "warn":
              warnings.warn(
                  NoMetaDataWarning(expr, field), stacklevel=4
              )
      return None
  
imports: from __future__ import division, absolute_import
  from abc import ABCMeta, abstractproperty
  from collections import namedtuple, defaultdict
  from functools import partial
  from itertools import count
  import warnings
  from weakref import WeakKeyDictionary
  import blaze
  from datashape import Date, DateTime, Option, isrecord, isscalar
  import numpy
  from odo import odo
  import pandas
  from six import with_metaclass, PY2, itervalues, iteritems
  from toolz import complement, compose, flip, groupby, identity, memoize, merge
  import toolz.curried.operator
  from catalyst.pipeline.common import AD_FIELD_NAME, SID_FIELD_NAME, TS_FIELD_NAME
  from catalyst.pipeline.data.dataset import DataSet, Column
  from catalyst.pipeline.loaders.utils import check_data_query_args, last_in_date_group, normalize_data_query_bounds, normalize_timestamp_to_query_time, ffill_across_cols
  from catalyst.pipeline.sentinels import NotSpecified
  from catalyst.lib.adjusted_array import AdjustedArray, can_represent_dtype
  from catalyst.lib.adjustment import make_adjustment_from_indices, OVERWRITE
  from catalyst.utils.input_validation import expect_element, ensure_timezone, optionally
  from catalyst.utils.numpy_utils import bool_dtype
  from catalyst.utils.pool import SequentialPool
  from catalyst.utils.preprocess import preprocess
label_desc: Use image node_id 5 for calling a global function with example usage: _get_metadata(field, expr, metadata_expr, no_metadata_rule) and returns: None, metadata_expr, expr