def _parse_args():
    parser = optparse.OptionParser()
    parser.add_option("-d", "--dry-run",
                      action="store_true", dest="dry_run", default=False,
                      help="don't actually remove locks")
    parser.add_option("-l", "--limit",
                      action="store", type='int', dest="limit",
                      default=sys.maxint,
                      help="max number of locks to delete (default: no limit)")
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False,
                      help="don't print status messages to stdout")

    options, args = parser.parse_args()

    try:
        days_old = int(args[0])
    except (IndexError, __HOLE__):
        parser.print_help()
        sys.exit(1)

    return options, days_old
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/tools/xenserver/cleanup_sm_locks.py/_parse_args