def safe_get(obj, *attrs):
    """Safely get nested attributes from an object."""
    try:
        for attr in attrs:
            obj = getattr(obj, attr)
            if callable(obj):
                obj = obj()
    except (AttributeError, TypeError):
        return None
    return obj
Safely get nested attributes from an object.
llama-index-integrations/readers/llama-index-readers-jira/llama_index/readers/jira/base.py