code: def replace(self, key, value):
          
          check_not_none(key, "key can't be None")
          check_not_none(value, "value can't be None")
  
          key_data = self._to_data(key)
          value_data = self._to_data(value)
  
          return self._replace_internal(key_data, value_data)
docs: Replaces the entry for a key only if it is currently mapped to some value.
  
          This is equivalent to:
              >>> if map.contains_key(key):
              >>>     return map.put(key,value)
              >>> else:
              >>>     return None
          except that the action is performed atomically.
  
          **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations
          of __hash__ and __eq__ defined in key's class.**
  
          **Warning 2:
          This method returns a clone of the previous value, not the original (identically equal) value previously put
          into the map.**
  
          :param key: (object), the specified key.
          :param value: (object), the value to replace the previous value.
          :return: (object), previous value associated with key, or ``None`` if there was no mapping for key.