input: Write a python function to download a file from a URL and save it locally.
  assert download_file("https://example.com/sample.txt") == "sample.txt"
  assert os.path.exists("sample.txt") == True
output: def download_file(url):
      import requests
      import os
      
      local_filename = url.split('/')[-1]
      
      with requests.get(url, stream=True) as response:
          response.raise_for_status()
          with open(local_filename, 'wb') as file:
              for chunk in response.iter_content(chunk_size=8192):
                  file.write(chunk)
      
      return local_filename