Remove type hints in Python source programmatically : <p>I have some source code written for Python 3.5 that I want to make executable under Python 3.4. The only feature from 3.5 that I use which is not available in 3.4 are type hints, so I'd like to write a script to remove those entirely.</p>

<p>This seemed easy enough at first glance and I decided to write some regexes to do this, but then I thought about a few edge cases and I wasn't sure how to solve the problem for a more complex function like this:</p>

<pre><code>def foo(bar: Dict[T, List[T]],
        baz: Callable[[T], int] = lambda x: (x+3)/7,
        **kwargs) -&gt; List[T]:
</code></pre>

<p>Basically, I'd have to parse the whole thing and rebuild the argument list without type annotations. How would I even approach this?</p>
