def download(uri, filename=None, headers=None, redirect_limit=5, **kwargs):
    from datetime import datetime
    from os import utime
    from os.path import getmtime
    from time import time
    from .tardis import datetime_to_timestamp
    try:
        last_modified = datetime.fromtimestamp(getmtime(filename))
    except OSError:
        last_modified = None
    with get(uri, if_modified_since=last_modified, headers=headers, redirect_limit=redirect_limit, **kwargs) as source:
        if source.status_code == 200:
            if not filename:
                filename = source.filename
            with open(filename, "wb") as destination:
                finished = False
                while not finished:
                    data = source.read(8192)
                    if data:
                        destination.write(data)
                    else:
                        finished = True
            utime(filename, (time(), datetime_to_timestamp(source.last_modified)))
            return True
        elif source.status_code == 304:
            return False
        else:
            raise ValueError("Unexpected status code %s from download response" % source.status_code)
Get a remote resource and save the content to a local file. If a local
dataset/ETHPy150Open nigelsmall/py2neo/py2neo/packages/httpstream/__init__.py/download