def int_flags(flags, mapper=const.PERM_STRING_MAP):
r = <NUM_LIT:0><EOL>if not flags:<EOL><INDENT>return r<EOL><DEDENT>if isinstance(flags, six.integer_types):<EOL><INDENT>return flags<EOL><DEDENT>if not isinstance(flags, six.string_types):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>for f in flags:<EOL><INDENT>for f_i, f_s in mapper:<EOL><INDENT>if f_s == f:<EOL><INDENT>r = r | f_i<EOL><DEDENT><DEDENT><DEDENT>return r<EOL>
Converts string permission flags into integer permission flags as
specified in const.PERM_STRING_MAP
Arguments:
    - flags <str>: one or more flags
        For example: "crud" or "ru" or "r"
    - mapper <list=const.PERM_STRING_MAP>: a list containing tuples mapping
        int permission flag to string permission flag. If not specified will
        default to const.PERM_STRING_MAP.
Returns:
    - int