def Exit ( msg , code = 1 ) : print >> sys . stderr , msg sys . exit ( code )
how to exit a code in python
Exit execution with return code and message : param msg : Message displayed prior to exit : param code : code returned upon exiting
def Exit(msg, code=1):
    """Exit execution with return code and message
    :param msg: Message displayed prior to exit
    :param code: code returned upon exiting
    """
    print >> sys.stderr, msg
    sys.exit(code)