def oneOf( strs, caseless=False, useRegex=True ):
if caseless:<EOL><INDENT>isequal = ( lambda a,b: a.upper() == b.upper() )<EOL>masks = ( lambda a,b: b.upper().startswith(a.upper()) )<EOL>parseElementClass = CaselessLiteral<EOL><DEDENT>else:<EOL><INDENT>isequal = ( lambda a,b: a == b )<EOL>masks = ( lambda a,b: b.startswith(a) )<EOL>parseElementClass = Literal<EOL><DEDENT>symbols = []<EOL>if isinstance(strs,basestring):<EOL><INDENT>symbols = strs.split()<EOL><DEDENT>elif isinstance(strs, Iterable):<EOL><INDENT>symbols = list(strs)<EOL><DEDENT>else:<EOL><INDENT>warnings.warn("<STR_LIT>",<EOL>SyntaxWarning, stacklevel=<NUM_LIT:2>)<EOL><DEDENT>if not symbols:<EOL><INDENT>return NoMatch()<EOL><DEDENT>i = <NUM_LIT:0><EOL>while i < len(symbols)-<NUM_LIT:1>:<EOL><INDENT>cur = symbols[i]<EOL>for j,other in enumerate(symbols[i+<NUM_LIT:1>:]):<EOL><INDENT>if ( isequal(other, cur) ):<EOL><INDENT>del symbols[i+j+<NUM_LIT:1>]<EOL>break<EOL><DEDENT>elif ( masks(cur, other) ):<EOL><INDENT>del symbols[i+j+<NUM_LIT:1>]<EOL>symbols.insert(i,other)<EOL>cur = other<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>i += <NUM_LIT:1><EOL><DEDENT><DEDENT>if not caseless and useRegex:<EOL><INDENT>try:<EOL><INDENT>if len(symbols)==len("<STR_LIT>".join(symbols)):<EOL><INDENT>return Regex( "<STR_LIT>" % "<STR_LIT>".join(_escapeRegexRangeChars(sym) for sym in symbols) ).setName('<STR_LIT>'.join(symbols))<EOL><DEDENT>else:<EOL><INDENT>return Regex( "<STR_LIT:|>".join(re.escape(sym) for sym in symbols) ).setName('<STR_LIT>'.join(symbols))<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>warnings.warn("<STR_LIT>",<EOL>SyntaxWarning, stacklevel=<NUM_LIT:2>)<EOL><DEDENT><DEDENT>return MatchFirst(parseElementClass(sym) for sym in symbols).setName('<STR_LIT>'.join(symbols))<EOL>
Helper to quickly define a set of alternative Literals, and makes
    sure to do longest-first testing when there is a conflict,
    regardless of the input order, but returns
    a :class:`MatchFirst` for best performance.

    Parameters:

     - strs - a string of space-delimited literals, or a collection of
       string literals
     - caseless - (default= ``False``) - treat all literals as
       caseless
     - useRegex - (default= ``True``) - as an optimization, will
       generate a Regex object; otherwise, will generate
       a :class:`MatchFirst` object (if ``caseless=True``, or if
       creating a :class:`Regex` raises an exception)

    Example::

        comp_oper = oneOf("< = > <= >= !=")
        var = Word(alphas)
        number = Word(nums)
        term = var | number
        comparison_expr = term + comp_oper + term
        print(comparison_expr.searchString("B = 12  AA=23 B<=AA AA>12"))

    prints::

        [['B', '=', '12'], ['AA', '=', '23'], ['B', '<=', 'AA'], ['AA', '>', '12']]