<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_file_from_s3(job, s3_url, encryption_key=None, write_to_jobstore=True):
 """ Downloads a supplied URL that points to an unencrypted, unprotected file on Amazon S3. The file is downloaded and a subsequently written to the jobstore and the return value is a the path to the file in the jobstore. """

    work_dir = job.fileStore.getLocalTempDir()
    filename = '/'.join([work_dir, os.path.basename(s3_url)])
    # This is common to encrypted and unencrypted downloads
    download_call = ['curl', '-fs', '--retry', '5']
    # If an encryption key was provided, use it to create teh headers that need to be injected into
    # the curl script and append to the call
    if encryption_key:
        key = generate_unique_key(encryption_key, s3_url)
        encoded_key = base64.b64encode(key)
        encoded_key_md5 = base64.b64encode( hashlib.md5(key).digest() )
        h1 = 'x-amz-server-side-encryption-customer-algorithm:AES256'
        h2 = 'x-amz-server-side-encryption-customer-key:{}'.format(encoded_key)
        h3 = 'x-amz-server-side-encryption-customer-key-md5:{}'.format(encoded_key_md5)
        download_call.extend(['-H', h1, '-H', h2, '-H', h3])
    # This is also common to both types of downloads
    download_call.extend([s3_url, '-o', filename])
    try:
        subprocess.check_call(download_call)
    except subprocess.CalledProcessError:
        raise RuntimeError('Curl returned a non-zero exit status processing %s. Do you' % s3_url +
                           'have premssions to access the file?')
    except OSError:
        raise RuntimeError('Failed to find "curl". Install via "apt-get install curl"')
    assert os.path.exists(filename)
    if write_to_jobstore:
        filename = job.fileStore.writeGlobalFile(filename)
    return filename