def parse_interval(interval_string):
 regexp = u'^\\d+ (second|minute|hour|day|week)s?$'
 if (not re.match(regexp, interval_string)):
  raise ValueError(u"should be in format 'x (seconds|minutes|hours|days|weeks)'")
 return parse_timedelta(interval_string)

def parse_interval ( interval_string ) : regexp = u'^\\d+ (second|minute|hour|day|week)s?$' if ( not re . match ( regexp , interval_string ) ) : raise ValueError ( u"should be in format 'x (seconds|minutes|hours|days|weeks)'" ) return parse_timedelta ( interval_string )
takes an interval string from the config and turns it into a :class:datetime .