Download file from url to filename.

def download_file(self, url, filename):
        """ Download file from url to filename. """
        self.print_message("Downloading to file '%s' from URL '%s'" % (filename, url))
        try:
            db_file = urllib2.urlopen(url)
            with open(filename, 'wb') as output:
                output.write(db_file.read())
            db_file.close()
        except Exception as e:
            self.error(str(e))
        self.print_message("File downloaded")