class MyException(Exception):
    
    '''A simple exception to demonstrate how they work.'''
    
    def __init__(self, value):
        self.value = value
        
    def __str__(self):
        return str(self.value) # Some string form of the object

def b():
    raise MyException('b was called!')

def a():
    try:
        b()
    except MyException, e:
        print e

if __name__ == "__main__":
    try:
        a()
        #print 1/0
    except ZeroDivisionError, e:
        print 'Division by zero error.'
        raise
    except MyException, e:
        print e
    else:
        print 'No exceptions were raised.'
    finally:
        print 'This will always be done'
