Hardcoded magic-number limits like this are a code smell, even if they are not practically reachable. Also, there's a needless inefficiency in doing the extra iteration and counting separators and comparisons when we know that we won't be removing any subclasses.

Just do the extra work only for the older Django versions that need it, and return the input unchanged otherwise.