def header(content_type='text/html', filename=None):
    """ Return the header needed for a CGI application.
			@param content_type: The type of content delivered (optional, defaults to text/html)
			@param filename: Set the content to be a downloadable file (optional)
	"""
    output = 'Content-Type: ' + str(content_type) + '; charset=utf-8\n\n'
    if filename:
        output = ('Content-Disposition: attachment; filename=' + filename +
            '\n' + output)
    return output
