code: def set_attribute(self, obj, attr, value):
          
          # if this is any mutable mapping then instead of attributes use keys
          if isinstance(obj, MutableMapping):
              obj[attr] = value
          else:
              setattr(obj, attr, value)
docs: Set value of attribute in given object instance.
  
          Reason for existence of this method is the fact that 'attribute' can
          be also a object's key if it is a dict or any other kind of mapping.
  
          Args:
              obj (object): object instance to modify
              attr (str): attribute (or key) to change
              value: value to set