def _fetch_and_compile_index(index_urls, logger=None, proxy_config=None):
    """
    Go through the index list and compile results into a single object.
    """
    status = []
    index = {}

    proxies_dict = {}
    verify = True

    if proxy_config:
        https_proxy = proxy_config.get("https_proxy", None)
        http_proxy = proxy_config.get("http_proxy", None)
        no_proxy = proxy_config.get("no_proxy", None)
        ca_bundle_path = proxy_config.get("proxy_ca_bundle_path", None)

        if https_proxy:
            proxies_dict["https"] = https_proxy
            verify = ca_bundle_path or True

        if http_proxy:
            proxies_dict["http"] = http_proxy

        if no_proxy:
            proxies_dict["no"] = no_proxy

    for index_url in index_urls:

        # TODO:
        # Bug  in requests doesn't bypass proxies, so we do it ourselves
        # If this issue ever gets fixed then we can remove it
        # https://github.com/psf/requests/issues/4871
        bypass_proxy = should_bypass_proxies(index_url, proxies_dict.get("no"))

        index_status = {
            "url": index_url,
            "packs": 0,
            "message": None,
            "error": None,
        }
        index_json = None

        try:
            request = requests.get(
                index_url,
                proxies=proxies_dict if not bypass_proxy else None,
                verify=verify if not bypass_proxy else True,
            )
            request.raise_for_status()
            index_json = request.json()
        except ValueError as e:
            index_status["error"] = "malformed"
            index_status["message"] = repr(e)
        except requests.exceptions.RequestException as e:
            index_status["error"] = "unresponsive"
            index_status["message"] = repr(e)
        except Exception as e:
            index_status["error"] = "other errors"
            index_status["message"] = repr(e)

        if index_json == {}:
            index_status["error"] = "empty"
            index_status["message"] = "The index URL returned an empty object."
        elif type(index_json) is list:
            index_status["error"] = "malformed"
            index_status["message"] = "Expected an index object, got a list instead."
        elif index_json and "packs" not in index_json:
            index_status["error"] = "malformed"
            index_status["message"] = 'Index object is missing "packs" attribute.'

        if index_status["error"]:
            logger.error(
                "Index parsing error: %s" % json_encode(index_status, indent=4)
            )
        else:
            # TODO: Notify on a duplicate pack aka pack being overwritten from a different index
            packs_data = index_json["packs"]
            index_status["message"] = "Success."
            index_status["packs"] = len(packs_data)
            index.update(packs_data)

        status.append(index_status)

    return index, status

    Go through the index list and compile results into a single object.
    
st2common/st2common/services/packs.py