You don't open/close the string properly:
querystring = "curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key"
should be:
querystring = """curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/search?jql=project=QA+order+by+duedate&fields=id,key"""
because the string itself contains double-quotes.