def get_trait_val(self, entity, trait_const, val='strval'):
        """Get the trait value of type L{val} of L{entity} that is of type
        L{trait_const}.

        @type entity: Cerebrum.Entity
        @param entity: The entity which trait is being looked up

        @type trait_const: _EntityTraitCode
        @param trait_const: The type of trait to load

        @rtype: str
        @return: The L{val} of the trait, if it exists. None if the L{entity}
                 doesn't have a trait of type L{trait_const}, or the trait
                 doesn't have a value L{val}
        """
        assert hasattr(entity, 'entity_id') and hasattr(entity, 'get_trait')
        try:
            trait = entity.get_trait(trait_const)
            return trait.get(val, None)
        except AttributeError:
            pass
        return None