code: def determine_linecol(
      data, paths, max_steps=5
  ) -> Tuple[Optional[int], Optional[int], int]:
      """Determine linecol from the CommentedMap for the `paths` location.
  
      CommentedMap from `ruamel.yaml` has `.lc` property from which we can read
      `.line` and `.col`. This is available in the collections type,
      i.e. list and dictionaries.
  
      But this may fail on non-collection types. For example, if the `paths` is
      ['stages', 'metrics'], metrics being a boolean type does not have `lc`
      prop.
      ```
      stages:
        metrics: true
      ```
  
      To provide some context to the user, we step up to the
      path ['stages'], which being a collection type, will have `lc` prop
      with which we can find line and col.
  
      This may end up being not accurate, so we try to show the same amount of
      lines of code for `n` number of steps taken upwards. In a worst case,
      it may be just 1 step (as non-collection item cannot have child items),
      but `schema validator` may provide us arbitrary path. So, this caps the
      number of steps upward to just 5. If it does not find any linecols, it'll
      abort.
      """
      from dpath import get
  
      step = 1
      line, col = None, None
      while paths and step < max_steps:
          value = get(data, paths, default=None)
          if value is not None:
              with suppress(AttributeError, TypeError):
                  line = value.lc.line + 1  # type: ignore[attr-defined]
                  col = value.lc.col + 1  # type: ignore[attr-defined]
                  break
          step += 1
          *paths, _ = paths
  
      return line, col, step
  
imports: import re
  import typing
  from contextlib import suppress
  from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple, TypeVar
  from dvc.exceptions import PrettyDvcException
  from dvc.ui import ui
  from dvc.utils.serialize import EncodingError, YAMLFileCorruptedError, parse_yaml, parse_yaml_for_update
label_desc: Use image node_id 5 for calling a global function with example usage: determine_linecol(data, paths, max_steps) and returns: line,  col,  step