code: def safer_getattr(object, name, default=None, getattr=getattr):
      """Getattr implementation which prevents using format on string objects.
  
      format() is considered harmful:
      http://lucumr.pocoo.org/2016/12/29/careful-with-str-format/
  
      """
      if name == "format" and isinstance(object, str):
          raise NotImplementedError(
              "Using format() on a %s is not safe."
              % object.__class__.__name__
          )
      if name[0] == "_":
          raise AttributeError(
              '"{name}" is an invalid attribute name because it '
              'starts with "_"'.format(name=name)
          )
      val = getattr(object, name, default)
      return val
  
imports: import logging
  from abc import abstractmethod
  from functools import lru_cache
  from datetime import datetime, timedelta
  from RestrictedPython import safe_builtins, utility_builtins, limited_builtins, compile_restricted
  from RestrictedPython.Eval import default_guarded_getitem
  from RestrictedPython.Guards import full_write_guard, guarded_iter_unpack_sequence, guarded_unpack_sequence
label_desc: Use image node_id 2 for calling a global function with example usage: safer_getattr(object, name, default, getattr) and returns: val