HTTP response from custom handler to azure

I am trying to set up communication between the azure runtime and the jupyter custom handler. The problem is that the allowed types for the finish() function do not allow azure.functions.HttpResponse (The type desired by azure). Does anyone know a workaround?
System.Private.CoreLib: Exception while executing function: Functions.PythonNotebook. Microsoft.Azure.WebJobs.Script: Invalid HttpResponseMessage:
StatusCode: 200, ReasonPhrase: ‘OK’, Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
[2021-04-15T08:50:30.376Z] {
[2021-04-15T08:50:30.377Z] Server: TornadoServer/6.1
[2021-04-15T08:50:30.378Z] Date: Thu, 15 Apr 2021 08:50:30 GMT
[2021-04-15T08:50:30.379Z] X-Content-Type-Options: nosniff
[2021-04-15T08:50:30.380Z] Content-Security-Policy: frame-ancestors ‘self’; report-uri /api/security/csp-report
[2021-04-15T08:50:30.381Z] Content-Type: text/html; charset=UTF-8
[2021-04-15T08:50:30.382Z] Content-Length: 43
[2021-04-15T08:50:30.383Z] }

It doesn’t require any special classes in the response, follow the examples here: (Azure Functions custom handlers | Microsoft Docs) See the response payload format.