code: def copy(self, **kwargs):
          
          msg = Message(self.encode(), self.gateway)
          for key, val in kwargs.items():
              setattr(msg, key, val)
          return msg
docs: Copy a message, optionally replace attributes with kwargs.