input: Write a python function to extract top-level domain from a query string and make an API request to fetch domain names.
  assert get_domain_names("example.com") == ["example.com", "example.net"]
  assert get_domain_names("test.org") == ["test.org", "test.info"]
  assert get_domain_names("sample.co.uk") == ["sample.co.uk", "sample.com"]
output: import re
  import requests
  
  def get_domain_names(query):
      # Extract the top-level domain using regex
      match = re.search(r'\.\w+$', query)
      if not match:
          return []
  
      tld = match.group(0)
      # Make an API request to fetch domain names
      response = requests.get(f"https://api.example.com/domains?tld={tld}")
      
      if response.status_code == 200:
          return response.json()
      else:
          return []