#NEWLINE# def modifies_known_mutable( obj , attr ) : #NEWLINE# #INDENT# 'This function checks if an attribute on a builtin mutable object\n    (list, dict, set or deque) would modify it if called.  It also supports\n    the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and\n    with Python 2.6 onwards the abstract base classes `MutableSet`,\n    `MutableMapping`, and `MutableSequence`.\n\n    >>> modifies_known_mutable({}, "clear")\n    True\n    >>> modifies_known_mutable({}, "keys")\n    False\n    >>> modifies_known_mutable([], "append")\n    True\n    >>> modifies_known_mutable([], "index")\n    False\n\n    If called with an unsupported object (such as unicode) `False` is\n    returned.\n\n    >>> modifies_known_mutable("foo", "upper")\n    False\n    ' #NEWLINE# for ( typespec , unsafe ) in _mutable_spec : #NEWLINE# #INDENT# if isinstance ( obj , typespec ) : #NEWLINE# #INDENT# return ( attr in unsafe ) #NEWLINE# #UNINDENT# #UNINDENT# return False