code: def _get_trie_pattern(
      self,
      dirname,
      dnames: Optional["List"] = None,
      ignore_subrepos=True,
  ) -> Optional["DvcIgnorePatterns"]:
      if ignore_subrepos:
          ignores_trie = self.ignores_trie_fs
      else:
          ignores_trie = self._ignores_trie_subrepos
  
      if not self.fs.isin_or_eq(dirname, self.root_dir):
          # outside of the repo
          return None
  
      key = self._get_key(dirname)
  
      ignore_pattern = ignores_trie.get(key)
      if ignore_pattern:
          return ignore_pattern
  
      prefix_key = ignores_trie.longest_prefix(key).key or ()
      prefix = self.fs.join(self.root_dir, *prefix_key)
  
      dirs = list(
          takewhile(
              lambda path: path != prefix,
              (parent for parent in localfs.parents(dirname)),
          )
      )
      dirs.reverse()
      dirs.append(dirname)
  
      for parent in dirs:
          self._update(parent, ignores_trie, dnames, ignore_subrepos)
  
      return ignores_trie.get(key)
  
imports: import os
  import re
  from collections import namedtuple
  from itertools import chain, groupby, takewhile
  from typing import TYPE_CHECKING, List, Optional
  from pathspec.patterns import GitWildMatchPattern
  from pathspec.util import normalize_file
  from pygtrie import Trie
  from dvc.fs import Schemes, localfs
  from dvc.log import logger
  from dvc.pathspec_math import PatternInfo, merge_patterns
label_desc: Use image node_id 10 for calling the DvcIgnoreFilter obj's underlying member method code with example usage: obj._get_trie_pattern(dirname, dnames, ignore_subrepos) and returns: ignores_trie, None, ignore_pattern