code: def replace(self, **kwargs):
          
  
          new_kwargs = {}
  
          strict = kwargs.pop("strict", True)
  
          try:
              localpart = kwargs.pop("localpart")
          except KeyError:
              pass
          else:
              if localpart:
                  localpart = nodeprep(
                      localpart,
                      allow_unassigned=not strict
                  )
              new_kwargs["localpart"] = localpart
  
          try:
              domain = kwargs.pop("domain")
          except KeyError:
              pass
          else:
              if not domain:
                  raise ValueError("domain must not be empty or None")
              new_kwargs["domain"] = nameprep(
                  domain,
                  allow_unassigned=not strict
              )
  
          try:
              resource = kwargs.pop("resource")
          except KeyError:
              pass
          else:
              if resource:
                  resource = resourceprep(
                      resource,
                      allow_unassigned=not strict
                  )
              new_kwargs["resource"] = resource
  
          if kwargs:
              raise TypeError("replace() got an unexpected keyword argument"
                              " {!r}".format(
                                  next(iter(kwargs))))
  
          return super()._replace(**new_kwargs)
docs: Construct a new :class:`JID` object, using the values of the current
          JID. Use the arguments to override specific attributes on the new
          object.
  
          All arguments are keyword arguments.
  
          :param localpart: Set the local part of the resulting JID.
          :param domain: Set the domain of the resulting JID.
          :param resource: Set the resource part of the resulting JID.
          :raises: See :class:`JID`
          :return: A new :class:`JID` object with the corresponding
              substitutions performed.
          :rtype: :class:`JID`
  
          The attributes of parameters which are omitted are not modified and
          copied down to the result.