input: Write a python function to download data from a given URL and save it to a file based on the content type.
  assert download_data("https://example.com/image.jpg") == "image.jpg"
  assert download_data("https://example.com/document.pdf") == "document.pdf"
  assert download_data("https://example.com/data.txt") == "data.txt"
output: import requests
  
  def download_data(url):
      response = requests.get(url)
      if response.status_code == 200:
          content_disposition = response.headers.get('content-disposition')
          if content_disposition:
              filename = content_disposition.split('filename=')[-1].strip('"')
          else:
              filename = url.split("/")[-1]
          with open(filename, 'wb') as file:
              file.write(response.content)
          return filename
      else:
          response.raise_for_status()