def setattr_default(obj, name, value):
    """Set attribute value, but only if it's not already set. Similar to
    setdefault() for dicts.
    """
    if not hasattr(obj, name):
        setattr(obj, name, value)
Set attribute value, but only if it's not already set. Similar to
    setdefault() for dicts.
    
stackoverflow/venv/lib/python3.6/site-packages/scrapy/utils/python.py