old_contents: try:
      import requests
      import vim
      import json
  except Exception:
      print("Error occurred while importing dependencies.")
  
  URL = ["http://api.duckduckgo.com/?q=", "&format=json&t=VimSearch"]
  
  def setUrl(query):
      URL.insert(1, query) 
      return ''.join(URL)#Return a string of the final URL (list to str)
  
  def searchToData(url):
      searchReq = requests.get(url)
      return searchReq#return a finalized get request from the url 
  
  def resultsToJson(data):
      data = data.content.decode("utf-8") #Byte >> string/utf-8
      jsonData = json.loads(data)#load to a json object)
      return jsonData
  
  def verifyLength(data):
      if len(data["RelatedTopics"]) > 2:
          parseTo = 3
      else: 
          parseTo = len(data["RelatedTopics"])
      return parseTo #Set up to 3 results, but if there are less than three,
  #then set to such.
  
  def setResults(data, max):
      results = []
      try:
          for x in range(max):
              results.append(data["RelatedTopics"][x]["Text"])
      except Exception:
          results.append("Sorry, no results for this query.")
      return results#Makes a list of strings of the results.
  
  def search(query):
      #url = setUrl(vim.eval("a:arg")) 
      url = setUrl(query)
      req = searchToData(url)
      jsonD = resultsToJson(req)
      results = setResults(jsonD, verifyLength(jsonD))
      for result in results:
           print(result)
      return
  if __name__ == "__main__":
      search(vim.eval("a:arg")) 
  
new_contents: try:
      import requests
      import vim
      import json
  except Exception:
      print("Error occurred while importing dependencies.")
  
  URL = ["http://api.duckduckgo.com/?q=", "&format=json&t=VimSearch"]
  
  def setUrl(query):
      URL.insert(1, query) 
      return ''.join(URL)#Return a string of the final URL (list to str)
  
  def searchToData(url):
      searchReq = requests.get(url)
      return searchReq#return a finalized get request from the url 
  
  def resultsToJson(data):
      data = data.content.decode("utf-8") #Byte >> string/utf-8
      jsonData = json.loads(data)#load to a json object)
      return jsonData
  
  def verifyLength(data):
      if len(data["RelatedTopics"]) > 2:
          parseTo = 3
      else: 
          parseTo = len(data["RelatedTopics"])
          if parseTo == 0:
              parseTo += 1
          #it needs to be at least one in order to show the error 
      return parseTo #Set up to 3 results, but if there are less than three,
  #then set to such.
  
  def setResults(data, max):
      results = []
      try:
          for x in range(max):
              results.append(data["RelatedTopics"][x]["Text"])
      except Exception:
          results.append("Sorry, no results for this query.")
      return results#Makes a list of strings of the results.
  
  def search(query):
      #url = setUrl(vim.eval("a:arg")) 
      url = setUrl(query)
      req = searchToData(url)
      jsonD = resultsToJson(req)
      results = setResults(jsonD, verifyLength(jsonD))
      for result in results:
           print(result)
      return
  if __name__ == "__main__":
      search(vim.eval("a:arg")) 
  
subject: Update error handling for a result-less query.