<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_url(job, any_url, encryption_key=None, per_file_encryption=True, write_to_jobstore=True):
 """ Download a supplied URL that points to a file on an http, https or ftp server. If the file is found to be an https s3 link then the file is downloaded using `get_file_from_s3`. The file is downloaded and written to the jobstore if requested. Encryption arguments are for passing to `get_file_from_s3` if required. :param str any_url: URL for the file :param str encryption_key: Path to the master key :param bool per_file_encryption: If encrypted, was the file encrypted using the per-file method? :param bool write_to_jobstore: Should the file be written to the job store? :return: Path to the downloaded file or fsID (if write_to_jobstore was True) :rtype: str|toil.fileStore.FileID """

    work_dir = job.fileStore.getLocalTempDir()

    filename = '/'.join([work_dir, str(uuid.uuid4())])
    url = any_url
    parsed_url = urlparse(any_url)
    try:
        response = urllib2.urlopen(url)
    except urllib2.HTTPError:
        if parsed_url.netloc.startswith(('s3', 'S3')):
            job.fileStore.logToMaster("Detected https link is for an encrypted s3 file.")
            return get_file_from_s3(job, any_url, encryption_key=encryption_key,
                                    per_file_encryption=per_file_encryption,
                                    write_to_jobstore=write_to_jobstore)
        else:
            raise
    else:
        with open(filename, 'w') as f:
            f.write(response.read())

    if write_to_jobstore:
        filename = job.fileStore.writeGlobalFile(filename)
    return filename