def copy(self, tagname, **kwargs):
        """
        Returns a new instance of `TagWrap` using the given *tagname* that has
        all the same attributes as this instance.  If *kwargs* is given they
        will override the attributes of the created instance.
        """
        new_kwargs = {
            'replacement': self.replacement,
            'whitelist': self.whitelist,
            'safe_mode': self.safe_mode,
            'log_rejects': self.log_rejects,
            'ending_slash': self.ending_slash
        }
        new_kwargs.update(**kwargs)
        return TagWrap(tagname, **new_kwargs)