def _get_newick(node, newick, parentdist, leaf_names, node_means):
    """
    Convert scipy Tree object into Newick string with annotated branches.

    Parameters
    ----------
    node : scipy.cluster.hierarchy.ClusterNode
        Cluster node.
    newick : str
        Newick string.
    parentdist : float
        Distance of parent node.
    leaf_names : list of str
        Leaf names (kinases).
    node_means : dict of int: float
        Mean distance (value) for each node index (key). Generated with `_get_mean_index`.

    Returns
    -------
    newick : str
        Newick string.
        Note: The return value is the populated input `newick` object.
    """

    if node.is_leaf():
        return f"{leaf_names[node.id]}:{round(parentdist - node.dist, 3)}{newick}"
    else:
        si_node = node_means[node.id]
        if len(newick) > 0:
            newick = f"){round(si_node, 3)}:{round(parentdist - node.dist, 3)}{newick}"
        else:
            newick = ");"
        newick = _get_newick(node.get_left(), newick, node.dist, leaf_names, node_means)
        newick = _get_newick(node.get_right(), f",{newick}", node.dist, leaf_names, node_means)
        newick = f"({newick}"
        return newick