def METHOD_NAME(self, data, format=None, content_type=None):
    """
    Encode the data returning a two tuple of (bytes, content_type)
    """
    if data is None:
        return ('', content_type)
    assert format is None or content_type is None, (
        'You may not set both `format` and `content_type`.'
    )
    if content_type:
        # Content type specified explicitly, treat data as a raw bytestring
        ret = force_bytes(data, settings.DEFAULT_CHARSET)
    else:
        format = format or self.default_format
        assert format in self.renderer_classes, (
            "Invalid format '{}'. Available formats are {}. "
            "Set TEST_REQUEST_RENDERER_CLASSES to enable "
            "extra request formats.".format(
                format,
                ', '.join(["'" + fmt + "'" for fmt in self.renderer_classes])
            )
        )
        # Use format and render the data into a bytestring
        renderer = self.renderer_classes[format]()
        ret = renderer.render(data)
        # Determine the content-type header from the renderer
        content_type = renderer.media_type
        if renderer.charset:
            content_type = "{}; charset={}".format(
                content_type, renderer.charset
            )
        # Coerce text to bytes if required.
        if isinstance(ret, str):
            ret = ret.encode(renderer.charset)
    return ret, content_type