code: def set_data(self, data: AnyStr) -> None:
          
          if isinstance(data, str):
              bytes_data = data.encode(self.charset)
          else:
              bytes_data = data
          self.response = self.data_body_class(bytes_data)
          if self.automatically_set_content_length:
              self.content_length = len(bytes_data)
docs: Set the response data.
  
          This will encode using the :attr:`charset`.