+1
You proposed using assertions in python, which is considered code smell outside of testing.
In this post: Introduce Assertion (refactoring.guru)
The python version of the code uses "assert" keyword which is always discouraged from being used outside tests because all assertions can be easily bypassed with debugging flag.
So in production code this is a code smell in python, and instead a "raise" keyword should be used.
Сервис поддержки клиентов работает на платформе UserEcho