Perhaps itamar was right. Ditch all the over-complicated API class and just have a function.
flake8