(obj, attr)
return value
Get the right value for the attribute. Handle special cases like callables
    and the __str__ attribute.
Get the right value for the attribute. Handle special cases like callables
    and the __str__ attribute.
Get the right value for the attribute . Handle special cases like callables and the __str__ attribute .
def get_attr(obj, attr):
    """
    Get the right value for the attribute. Handle special cases like callables
    and the __str__ attribute.
    """
    if attr == '__str__':
        from builtins import str as text
        value = text(obj)
    else:
        attribute = getattr(obj, attr)
        value = attribute() if callable(attribute) else attribute
    return value
def get_attr ( obj , attr ) : if attr == '__str__' : from builtins import str as text value = text ( obj ) else : attribute = getattr ( obj , attr ) value = attribute ( ) if callable ( attribute ) else attribute return value