def METHOD_NAME(obj, attr):
    if isinstance(obj, _AttrDict):
        has_attr = not obj._is_arbitrary_attr(attr)
    elif isinstance(obj, dict):
        return attr in obj
    else:
        has_attr = hasattr(obj, attr)
    return has_attr