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

2 files changed