def chkopts(opts):
    from karesansui.lib.utils import generate_phrase, generate_uuid, string_from_uuid, is_uuid
    from karesansui.lib.const import DEFAULT_LANGS

    reg_email = re.compile("^[a-zA-Z0-9\./_-]{1,}@[a-zA-Z0-9\./-]{4,}$")
    if opts.email:
        if reg_email.search(opts.email) is None:
            raise Exception('ERROR: Illigal option value. option=%s value=%s' % ('-m or --email', opts.email))
    else:
        raise Exception('ERROR: %s option is required.' % '-m or --email')

    reg_passwd = re.compile("^.{5,}")
    if opts.password:
        if reg_passwd.search(opts.password) is None:
            raise Exception(('-p or --password', opts.password) % 'ERROR: Illigal option value. option=%s value=%s')
    else:
        pass

    if opts.password == "":
        opts.password = generate_phrase(8)

    if opts.uuid:
        if is_uuid(opts.uuid) is False:
            raise Exception('ERROR: Illigal option value. option=%s value=%s' % ('-u or --uuid', opts.uuid))
    else:
        pass

    if opts.uuid == "":
        opts.uuid = string_from_uuid(generate_uuid())

    reg_fqdn = re.compile("^[a-z0-9][a-z0-9\.\-]{2,}$")
    if opts.fqdn:
        if reg_fqdn.search(opts.fqdn) is None:
            raise Exception('ERROR: Illigal option value. option=%s value=%s' % ('-f or --fqdn', opts.fqdn))
    else:
        pass

    if opts.fqdn == "":
        opts.fqdn = socket.gethostname() 

    reg_lang = re.compile("^[a-z]{2}_[A-Z]{2}$")
    if opts.lang:
        if reg_lang.search(opts.lang) is None:
            raise Exception('ERROR: Illigal option value. option=%s value=%s' % ('-l or --lang', opts.lang))
    else:
        pass

    if opts.lang == "":
        try:
            DEFAULT_LANGS[os.environ["LANG"][0:5]]
            opts.lang = os.environ["LANG"][0:5]
        except:
            opts.lang = "en_US"
dataset/ETHPy150Open karesansui/karesansui/tools/initialize_database.py/chkopts/swapped operands of `%`