Copied most of the download methods into a new fileutils module

Also added unit tests
Use fileutils in artifacts
Update test_artifacts

Also some flake8 fixes