def to_seconds(value, strict=True, force_int=True):
if isinstance(value, int):<EOL><INDENT>return value  <EOL><DEDENT>elif isinstance(value, timedelta):<EOL><INDENT>seconds = value.total_seconds()<EOL>if force_int:<EOL><INDENT>seconds = int(round(seconds))<EOL><DEDENT>return seconds<EOL><DEDENT>elif isinstance(value, str):<EOL><INDENT>hours, minutes, seconds = _parse(value, strict)<EOL><DEDENT>elif isinstance(value, tuple):<EOL><INDENT>check_tuple(value, strict)<EOL>hours, minutes, seconds = value<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>' % (<EOL>value, type(value).__name__<EOL>)<EOL>)<EOL><DEDENT>if not (hours or minutes or seconds):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>result = hours*<NUM_LIT> + minutes*<NUM_LIT> + seconds<EOL>return result<EOL>
converts duration value to integer seconds

strict=True (by default) raises StrictnessError if either hours,
minutes or seconds in duration value exceed allowed values