def create_file_with_sourcecode(sourcecode):
    # Creates a temporary file containing the sourcecode passed.
    path=sourcecode
    filename=Path(sourcecode).name
    if path.startswith(settings.MEDIA_URL):
        set_progress("Converting relative URL to filesystem path")
        path = path.replace(settings.MEDIA_URL, settings.MEDIA_ROOT)
    path = os.path.join(settings.MEDIA_ROOT, path)
    archive=io.BytesIO()
    with zipfile.ZipFile(archive, 'w') as zip_archive:
        with open(path, 'r') as file:
            zip_file = zipfile.ZipInfo(filename)
            zip_archive.writestr(zip_file, file.read())
    archive.seek(0)
    media=MediaIoBaseUpload(archive, mimetype='application/zip')
    return media