'Add an ephemeral constant to the set. An ephemeral constant
is a no argument function that returns a random value. The value
of the constant is constant for a Tree, but may differ from one
Tree to another.
:param name: name used to refers to this ephemeral type.
:param ephemeral: function with no arguments returning a random value.
:param ret_type: type of the object returned by *ephemeral*.'

def addEphemeralConstant(self, name, ephemeral, ret_type):

    module_gp = globals()
    if (name not in module_gp):
        class_ = type(name, (Ephemeral,), {'func': staticmethod(ephemeral), 'ret': ret_type})
        module_gp[name] = class_
    else:
        class_ = module_gp[name]
        if issubclass(class_, Ephemeral):
            if (class_.func is not ephemeral):
                raise Exception('Ephemerals    with    different    functions    should    be    named    differently,    even    between    psets.')
            elif (class_.ret is not ret_type):
                raise Exception('Ephemerals    with    the    same    name    and    function    should    have    the    same    type,    even    between    psets.')
        else:
            raise Exception('Ephemerals    should    be    named    differently    than    classes    defined    in    the    gp    module.')
    self._add(class_)
    self.terms_count += 1
