def download(
    state, host, source_url, destination,
    user=None, group=None, mode=None, cache_time=None, force=False,
):
    '''
    Download files from remote locations.
    + source_url: source URl of the file
    + destination: where to save the file
    + user: user to own the files
    + group: group to own the files
    + mode: permissions of the files
    + cache_time: if the file exists already, re-download after this time (in s)
    + force: always download the file, even if it already exists
    '''
    info = host.fact.file(destination)
    if info is False:
        raise OperationError(
            'Destination {0} already exists and is not a file'.format(destination),
        )
    download = force
    if info is None:
        download = True
    elif cache_time:
        cache_time = host.fact.date.replace(tzinfo=None) - timedelta(seconds=cache_time)
        if info['mtime'] and info['mtime'] > cache_time:
            download = True
    if download:
        yield 'wget -q {0} -O {1}'.format(source_url, destination)
        if user or group:
            yield chown(destination, user, group)
        if mode:
            yield chmod(destination, mode)