def unpack_nid(nid_str):
    """Unpack a unique id, hostname and port from a network id string.

    Parameters
    ----------
    nid_str : str

    Returns
    -------
    uid : str
    host : str
    port : int
    """
    if nid_str:
        id_list = nid_str.rsplit('@', 1)
        if len(id_list) == 2:
            addr_list = id_list[1].rsplit(':', 1)
            if len(addr_list) == 2:
                return id_list[0], addr_list[0], addr_list[1]
    return None, None, None