HH-37492 stricter handler release check

HH-37492 better error logging
HH-37492 finally move tests to appropriate location
HH-37492 cleanup, correct code handling in tuple case
HH-37492 more cleanup and proper error message formatting
HH-37492 PEP8ify
Merge remote-tracking branch 'origin/HH-37492' into EXP-10357
release 2.18.13 [a.shaposhnikov@hh.ru]