docs: 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 overriden.
  
      >>> from jinja2.sandbox import is_internal_attribute
      >>> is_internal_attribute(lambda: None, "func_code")
      True
      >>> is_internal_attribute((lambda x:x).func_code, 'co_code')
      True
      >>> is_internal_attribute(str, "upper")
      False
      """
      if isinstance(obj, FunctionType):
          if attr in UNSAFE_FUNCTION_ATTRIBUTES:
              return True
      elif isinstance(obj, 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, (CodeType, TracebackType, FrameType)):
          return True
      elif isinstance(obj, GeneratorType):
          if attr == 'gi_frame':
              return True
      return attr.startswith('__')