Replace cgi.parse_header() with custom function for Python 3.13 compat The cgi module has been deprecated since Python 3.11 and got removed in Python 3.13. Replace the cgi.parse_header() function with a custom one, as recommended by the Python documentation.