def calculate_number_of_stems_by_type(morphology, node_types):
    """
        Calculate the number of soma stems.
        This is defined as the total number of non-soma child nodes on soma nodes.

        Parameters
        ----------
        morphology: Morphology object

        node_types: list (AXON, BASAL_DENDRITE, APICAL_DENDRITE)
        Type to restrict search to

        Returns
        -------

        Scalar value

    """
    soma = morphology.get_root()
    return len(morphology.get_children_of_node_by_types(soma, node_types))
