You have two places in your code where you have a quote character next to an open parenthesis. You need to put a comma between them as a separate, because if you don't, the parenthesis are treated as the function-call operator and the Python strings are interpreted as if they were functions.
Also, in the future, always include your full traceback verbatim, you'll likely save us a great deal of time helping you. In a case like this, hard-coding input variables so long as the problem is reproducible is always advantageous, since in this case it was reproducible either branch, and the code short and simple enough to understand, that is not always the case.
Due to the reasons discussed here
we will be moving to python-forum.io
on October 1, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.