def _interval_string_to_seconds(interval_string):
interval_exc = "<STR_LIT>".format(interval_string)<EOL>interval_dict = {"<STR_LIT:s>": <NUM_LIT:1>, "<STR_LIT:m>": <NUM_LIT>, "<STR_LIT:h>": <NUM_LIT>, "<STR_LIT:D>": <NUM_LIT>,<EOL>"<STR_LIT>": <NUM_LIT:7>*<NUM_LIT>, "<STR_LIT:M>": <NUM_LIT:30>*<NUM_LIT>, "<STR_LIT:Y>": <NUM_LIT>*<NUM_LIT>}<EOL>interval_regex = re.compile("<STR_LIT>")<EOL>seconds = <NUM_LIT:0><EOL>while interval_string:<EOL><INDENT>match = interval_regex.match(interval_string)<EOL>if match:<EOL><INDENT>num, ext = int(match.group("<STR_LIT>")), match.group("<STR_LIT>")<EOL>if num > <NUM_LIT:0> and ext in interval_dict:<EOL><INDENT>seconds += num * interval_dict[ext]<EOL>interval_string = interval_string[match.end():]<EOL><DEDENT>else:<EOL><INDENT>raise Exception(interval_exc)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise Exception(interval_exc)<EOL><DEDENT><DEDENT>return seconds<EOL>
Convert internal string like 1M, 1Y3M, 3W to seconds.

    :type interval_string: str
    :param interval_string: Interval string like 1M, 1W, 1M3W4h2s...
        (s => seconds, m => minutes, h => hours, D => days,
         W => weeks, M => months, Y => Years).

    :rtype: int
    :return: The conversion in seconds of interval_string.