save a file to disk from a given url

def urlretrieve(url, dest, write_mode="w"):
    """save a file to disk from a given url"""
    response = urllib2.urlopen(url)
    mkdir_recursive(os.path.dirname(dest))
    with open(dest, write_mode) as f:
        f.write(response.read())
        f.close()