Add CORS support

Adds support for cross origin resource sharing (CORS), which is required to access the API from a webpage not hosted on the same subdomain. The cors.py file was taken from flask's own website, and very slightly modified to run on python 3.