code: def belongs_to(package):
      if not hasattr(package, "__file__"):  # pragma: no cover
          return lambda filepath: False
  
      root = Path(package.__file__).resolve().parent
      cache = {str: {}, bytes: {}}
  
      def accept(filepath):
          ftype = type(filepath)
          try:
              return cache[ftype][filepath]
          except KeyError:
              pass
          try:
              Path(filepath).resolve().relative_to(root)
              result = True
          except Exception:
              result = False
          cache[ftype][filepath] = result
          return result
  
      accept.__name__ = f"is_{package.__name__}_file"
      return accept
  
imports: import contextlib
  import os
  import sys
  import textwrap
  import traceback
  from inspect import getframeinfo
  from pathlib import Path
  from typing import Dict, NamedTuple, Optional, Type
  import hypothesis
  from hypothesis.errors import DeadlineExceeded, HypothesisException, StopTest, UnsatisfiedAssumption, _Trimmable
  from hypothesis.internal.compat import BaseExceptionGroup
  from hypothesis.utils.dynamicvariables import DynamicVariable
label_desc: Use image node_id 1 for calling a global function with example usage: belongs_to(package) and returns: accept, function, result, cache