          schema = generator.get_schema(request=None, public=True)
  
          renderer = self.get_renderer(options['format'])
          output = renderer.render(schema, renderer_context={})
          self.stdout.write(output.decode('utf-8'))
  
      def get_renderer(self, format):
          renderer_cls = {
              'corejson': CoreJSONRenderer,
              'openapi': OpenAPIRenderer,
 
</s> remove         return yaml.dump(structure, default_flow_style=False).encode('utf-8')
 </s> add         return yaml.dump(structure, default_flow_style=False).encode() </s> remove         self.assertEqual(strip_trailing_whitespace(content.decode('utf-8')), _indented_repr)
 </s> add         self.assertEqual(strip_trailing_whitespace(content.decode()), _indented_repr) </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() </s> remove         content = response.content.decode('utf8')
 </s> add         content = response.content.decode()
        self.stdout.write(output.decode())
          schema = generator.get_schema(request=None, public=True)
  
          renderer = self.get_renderer(options['format'])
          output = renderer.render(schema, renderer_context={})
        self.stdout.write(output.decode())
  
      def get_renderer(self, format):
          renderer_cls = {
              'corejson': CoreJSONRenderer,
              'openapi': OpenAPIRenderer,
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/management/commands/generateschema.py