docs: def download_file(request):
      '''Create and download a zip file containing the media file.'''
      if request.method == "GET":
          if path.exists(settings.MEDIA_ROOT):
              zipfile_name = 'media_%s.zip' % settings.SITE_NAME
              in_memory_file = BytesIO()
  
              media_zipfile = zipfile.ZipFile(in_memory_file, 'w',
                                              zipfile.ZIP_DEFLATED)
  
              directory_name = path.split(settings.MEDIA_ROOT)[-1]
              for root, dirs, files in walk(directory_name):
                  for file in files:
                      media_zipfile.write(path.join(root, file))
  
              media_zipfile.close()
  
              resp = HttpResponse(in_memory_file.getvalue(),
                                  content_type="application/x-zip-compressed")
              resp['Content-Disposition'] = (
                  'attachment; filename=%s' % zipfile_name)
  
          else:
              resp = render(request,
                            'django_admin/transfer_media_message.html',
                            {'error_message':
                             'media file does not exist'})
      else:
          resp = HttpResponseNotAllowed(permitted_methods=['GET'])
  
      return resp