def EnsureDefinition(name, definition, target=__builtins__.__dict__):
    """
    EnsureDefinition(name, definition, target)

    Ensure that a name exists in the given target namespace (a dictionary). If 
    it does exist, do nothing. If it doesn't, execute the definition in the 
    target.
    """
    print 'Checking for %s in target...' % name,
    if target.has_key(name):
        print 'found.'
    else:
        print 'not found! Defining with %s' % definition
        exec definition in target

    EnsureDefinition(name, definition, target)

    Ensure that a name exists in the given target namespace (a dictionary). If 
    it does exist, do nothing. If it doesn't, execute the definition in the 
    target.
    
recipes/Python/172431_Ensuring_name_definitimodule/recipe-172431.py