input: Write a python function to fetch the top 10 headlines from the New York Times API, given an API key.
  assert len(fetch_top_headlines('INSERT-VALID-KEY-HERE'))==10
  assert isinstance(fetch_top_headlines('INSERT-VALID-KEY-HERE')[0], str)
  assert all(isinstance(headline, str) for headline in fetch_top_headlines('INSERT-VALID-KEY-HERE'))
output: def fetch_top_headlines(api_key):
      import requests
      
      url = f"https://api.nytimes.com/svc/topstories/v2/home.json?api-key={api_key}"
      response = requests.get(url)
      data = response.json()
      
      headlines = [article['title'] for article in data['results'][:10]]
      return headlines