download a URL and return the content

def download_url(url):
    '''download a URL and return the content'''
    import urllib2
    try:
        resp = urllib2.urlopen(url)
        headers = resp.info()
    except urllib2.URLError as e:
        print('Error downloading %s' % url)
        return None
    return resp.read()