Fix C901 "method" is too complex for setuphandler.py