

def _render(resource, request):
    result = resource.render(request)
    if isinstance(result, bytes):
        request.write(result)
        request.finish()
        return succeed(None)
    elif (result is server.NOT_DONE_YET):
        if request.finished:
            return succeed(None)
        else:
            return request.notifyFinish()
    else:
        raise ValueError(('Unexpected return value: %r' % (result,)))

dataset/ETHPy150Open twisted/twisted/twisted/web/test/_util.py _render/original