code: def alter_old_distutils_request(request: WSGIRequest):
      
      # We first need to retrieve the body before accessing POST or FILES since
      # it can only be read once.
      body = request.body
      if request.POST or request.FILES:
          return
  
      new_body = BytesIO()
  
      # Split the response in the various parts based on the boundary string
      content_type, opts = parse_header(request.META['CONTENT_TYPE'].encode('ascii'))
      parts = body.split(b'\n--' + opts['boundary'] + b'\n')
      for part in parts:
          if b'\n\n' not in part:
              continue
  
          headers, content = part.split(b'\n\n', 1)
          if not headers:
              continue
  
          new_body.write(b'--' + opts['boundary'] + b'\r\n')
          new_body.write(headers.replace(b'\n', b'\r\n'))
          new_body.write(b'\r\n\r\n')
          new_body.write(content)
          new_body.write(b'\r\n')
      new_body.write(b'--' + opts['boundary'] + b'--\r\n')
  
      request._body = new_body.getvalue()
      request.META['CONTENT_LENGTH'] = len(request._body)
  
      # Clear out _files and _post so that the request object re-parses the body
      if hasattr(request, '_files'):
          delattr(request, '_files')
      if hasattr(request, '_post'):
          delattr(request, '_post')
docs: Alter the request body for compatibility with older distutils clients
  
      Due to a bug in the Python distutils library, the request post is sent
      using \n as a separator instead of the \r\n that the HTTP spec demands.
      This breaks the Django form parser and therefore we have to write a
      custom parser.
  
      This bug was fixed in the Python 2.7.4 and 3.4:
  
      http://bugs.python.org/issue10510