def split_addrs(addrs):
    '''Split addresses into dictionaries by hosts and ports.

    :param list addrs: A list of addresses.

    :returns:
        A dictionary of dictionaries, where ``dict[HOST][PORT]`` holds a list
        of all agent addresses in that environment.
    '''
    splitted = {}
    for addr in addrs:
        host, port, _ = _addr_key(addr)
        if host not in splitted:
            splitted[host] = {}
        if port not in splitted[host]:
            splitted[host][port] = []
        splitted[host][port].append(addr)
    return splitted