def _cleanUpSearchResults(search_results, total):
    """
    Helper function for _searchRepos(). Clean up search results.

    GIVEN:
      search_results (list) -- list of search results
      total (int) -- total number of search results to return

    RETURN:
      results (list) -- cleaned up search results
    """
    results = list()
    for res in search_results:
        element = [
            res["node"]["url"],
            res["node"]["stargazerCount"]
        ]
        if res["node"]["primaryLanguage"] is None:
            element.append("None")
        else:
            element.append(res["node"]["primaryLanguage"]["name"])

        results.append(element)

    if total == 0:
        return results
    else:
        return results[:total]