(morphisms)
return newmorphisms
Given a dictionary mapping morphisms to their properties,
        returns a new dictionary in which there are no morphisms which
        do not have properties, and which are compositions of other
        morphisms included in the dictionary.  Identities are dropped
        as well.
Given a dictionary mapping morphisms to their properties,
        returns a new dictionary in which there are no morphisms which
        do not have properties, and which are compositions of other
        morphisms included in the dictionary.  Identities are dropped
        as well.
Given a dictionary mapping morphisms to their properties returns a new dictionary in which there are no morphisms which do not have properties and which are compositions of other morphisms included in the dictionary . Identities are dropped as well .
def _simplify_morphisms(morphisms):
        """
        Given a dictionary mapping morphisms to their properties,
        returns a new dictionary in which there are no morphisms which
        do not have properties, and which are compositions of other
        morphisms included in the dictionary.  Identities are dropped
        as well.
        """
        newmorphisms = {}
        for morphism, props in morphisms.items():
            if isinstance(morphism, CompositeMorphism) and not props:
                continue
            elif isinstance(morphism, IdentityMorphism):
                continue
            else:
                newmorphisms[morphism] = props
        return newmorphisms
def _simplify_morphisms ( morphisms ) : newmorphisms = { } for morphism , props in morphisms . items ( ) : if isinstance ( morphism , CompositeMorphism ) and not props : continue elif isinstance ( morphism , IdentityMorphism ) : continue else : newmorphisms [ morphism ] = props return newmorphisms