refactored the type recognizers and code generators in __init__ since a lot of them are redundant between py2 and py3. Also, removed lambdas since lambda t: f(t) is just f