def s_from_dhms(time):
dhms_s = { '<STR_LIT:s>' : <NUM_LIT:1>, '<STR_LIT:m>' : <NUM_LIT>, '<STR_LIT:h>' : <NUM_LIT>, '<STR_LIT:d>' : <NUM_LIT> }<EOL>time = time.lower()<EOL>word_list = re.findall('<STR_LIT>',time)<EOL>seconds=<NUM_LIT:0> <EOL>for word in word_list:<EOL><INDENT>if word != '<STR_LIT>':<EOL><INDENT>sec = <NUM_LIT:1><EOL>for t in list(dhms_s.keys()):<EOL><INDENT>nw = word.replace(t,'<STR_LIT>')<EOL>if nw != word:<EOL><INDENT>sec = dhms_s[t]<EOL>word = nw<EOL>break<EOL><DEDENT><DEDENT>try:<EOL><INDENT>seconds += int(word) * sec<EOL><DEDENT>except:<EOL><INDENT>raise RuntimeError('<STR_LIT>' + time)<EOL><DEDENT><DEDENT><DEDENT>return seconds<EOL>
return seconds from dhms