Support direct threading and switch dispatch

Code generation for both dispatch techniques supported via COG tool for
Python.