code: def is_internal_attribute(obj, attr):
      """Test if the attribute given is an internal python attribute.  For
      example this function returns `True` for the `func_code` attribute of
      python objects.  This is useful if the environment method
      :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden.
  
      >>> from jinja2.sandbox import is_internal_attribute
      >>> is_internal_attribute(str, "mro")
      True
      >>> is_internal_attribute(str, "upper")
      False
      """
      if isinstance(obj, types.FunctionType):
          if attr in UNSAFE_FUNCTION_ATTRIBUTES:
              return True
      elif isinstance(obj, types.MethodType):
          if (
              attr in UNSAFE_FUNCTION_ATTRIBUTES
              or attr in UNSAFE_METHOD_ATTRIBUTES
          ):
              return True
      elif isinstance(obj, type):
          if attr == "mro":
              return True
      elif isinstance(
          obj, (types.CodeType, types.TracebackType, types.FrameType)
      ):
          return True
      elif isinstance(obj, types.GeneratorType):
          if attr in UNSAFE_GENERATOR_ATTRIBUTES:
              return True
      elif hasattr(types, "CoroutineType") and isinstance(
          obj, types.CoroutineType
      ):
          if attr in UNSAFE_COROUTINE_ATTRIBUTES:
              return True
      elif hasattr(types, "AsyncGeneratorType") and isinstance(
          obj, types.AsyncGeneratorType
      ):
          if attr in UNSAFE_ASYNC_GENERATOR_ATTRIBUTES:
              return True
      return attr.startswith("__")
  
imports: import operator
  import types
  import warnings
  from collections import deque
  from string import Formatter
  from markupsafe import EscapeFormatter
  from markupsafe import Markup
  from ._compat import abc
  from ._compat import PY2
  from ._compat import range_type
  from ._compat import string_types
  from .environment import Environment
  from .exceptions import SecurityError
label_desc: Use image node_id 4 for calling a global function with example usage: is_internal_attribute(obj, attr) and returns: attr, True, True, True, True, True, True, True