If you are using Python2, you need to open your output CSV file in 'wb' mode instead of 'w' mode. It worked for me and hopefully will solve your problem too. Use the following line.
with open('mytest.csv', 'wb') as csvfile:
If you are using Python3, 'w' mode should not put the blank line.