def main():
    """
    What will be executed when running as a stand alone program.
    """
    args = parse_args()

    try:
        hsm = pyhsm.base.YHSM(device=args.device, debug=args.debug)

        if args.debug or args.verbose:
            print "Device  : %s" % (args.device)
            print "Version : %s" % (hsm.info())
            print ""

        password = get_password(hsm, args)
        otp = get_otp(hsm, args)
        if not password and not otp:
            print "\nAborted\n"
            return 1
        else:
            if args.debug or args.verbose:
                print ""
            if hsm.unlock(password = password, otp = otp):
                if args.debug or args.verbose:
                    print "OK\n"
    except pyhsm.exception.YHSM_Error, e:
        sys.stderr.write("ERROR: %s\n" % (e.reason))
        if e.reason == "YubiHSM did not respond to command YSM_SYSTEM_INFO_QUERY":
            sys.stderr.write("Please check whether your YubiHSM is really at " + args.device + ", you can specify an alternate device using the option -D")
        return 1

    return 0
What will be executed when running as a stand alone program.