bpo-36390: simplify classifyws(), rename it and add unit tests (GH-14500)

(cherry picked from commit 9b5ce62cac27fec9dea473865d79c2c654312957)

Co-authored-by: Tal Einat <taleinat@gmail.com>
2 files changed