code: def safe_getattr(brain_or_object, attr, default=_marker):
      
      try:
          value = getattr(brain_or_object, attr, _marker)
          if value is _marker:
              if default is not _marker:
                  return default
              fail("Attribute '{}' not found.".format(attr))
          if callable(value):
              return value()
          return value
      except Unauthorized:
          if default is not _marker:
              return default
          fail("You are not authorized to access '{}' of '{}'.".format(
              attr, repr(brain_or_object)))
docs: Return the attribute value
  
      :param brain_or_object: A single catalog brain or content object
      :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain
      :param attr: Attribute name
      :type attr: str
      :returns: Attribute value
      :rtype: obj