          assert yaml, 'Using OpenAPIRenderer, but `pyyaml` is not installed.'
  
      def render(self, data, media_type=None, renderer_context=None):
          structure = self.get_structure(data)
          return yaml.dump(structure, default_flow_style=False).encode('utf-8')
  
  
  class JSONOpenAPIRenderer(_BaseOpenAPIRenderer):
      media_type = 'application/vnd.oai.openapi+json'
      charset = None
 
</s> remove         return json.dumps(structure, indent=4).encode('utf-8')
 </s> add         return json.dumps(structure, indent=4).encode() </s> remove         assert expected_error in response.rendered_content.decode('utf-8')
 </s> add         assert expected_error in response.rendered_content.decode() </s> remove         self.stdout.write(output.decode('utf-8'))
 </s> add         self.stdout.write(output.decode()) </s> remove         content = response.content.decode('utf8')
 </s> add         content = response.content.decode() </s> remove         content = response.content.decode('utf8')
 </s> add         content = response.content.decode()
        return yaml.dump(structure, default_flow_style=False).encode()
          assert yaml, 'Using OpenAPIRenderer, but `pyyaml` is not installed.'
  
      def render(self, data, media_type=None, renderer_context=None):
          structure = self.get_structure(data)
        return yaml.dump(structure, default_flow_style=False).encode()
  
  
  class JSONOpenAPIRenderer(_BaseOpenAPIRenderer):
      media_type = 'application/vnd.oai.openapi+json'
      charset = None
keep keep keep keep replace keep keep keep keep keep
 Drop default 'utf-8' to .encode()/.decode() (#6633)

A Python 3 cleanup that allows for less noise in the code.

https://docs.python.org/3/library/stdtypes.html#bytes.decode
https://docs.python.org/3/library/stdtypes.html#str.encode 
rest_framework/renderers.py