code: def check_dict_structure_same(a, b, prefix=None):
      def _p(k):
          if prefix is None:
              return k
          return ".".join(str(i) for i in prefix + [k])
  
      for ai, bi in itertools.zip_longest(
          a.items(), b.items(), fillvalue=("_KEY_NOT_EXISTS_", None)
      ):
          if ai[0] != bi[0]:
              if "*" in ai[0]:
                  pattern, target = ai[0], bi[0]
              elif "*" in bi[0]:
                  pattern, target = bi[0], ai[0]
              else:
                  raise KeyError(f"Key {_p(ai[0])} != {_p(bi[0])}")
              if not fnmatch.fnmatch(target, pattern):
                  raise KeyError(
                      f"Key {_p(target)} not match {_p(pattern)}"
                  )
  
          if ai[1] is DICT_NOT_EMPTY:
              target = bi[1]
          elif bi[1] is DICT_NOT_EMPTY:
              target = ai[1]
          else:
              target = None
          if target is not None:
              if not isinstance(target, dict):
                  raise TypeError(
                      f"Value type of {_p(ai[0])} is not a dict."
                  )
              if not target:
                  raise TypeError(f"Value of {_p(ai[0])} empty.")
              continue
  
          if type(ai[1]) is not type(bi[1]):
              raise TypeError(
                  f"Value type of {_p(ai[0])} mismatch {ai[1]} != {bi[1]}"
              )
          if isinstance(ai[1], dict):
              check_dict_structure_same(
                  ai[1],
                  bi[1],
                  [ai[0]] if prefix is None else prefix + [ai[0]],
              )
  
imports: import fnmatch
  import functools
  import inspect
  import itertools
  import logging
  import os
  import sys
  import time
  import types
  from typing import Dict
  import numpy
  import pandas
  import pytest
  from ..core.operand import OperandStage
  from ..utils import lazy_import
label_desc: Use image node_id 12 for calling a global function with example usage: check_dict_structure_same(a, b, prefix) and returns: str, k