'Convert a time slot string expression into a dateutil rrule
within the context of a time period
@param start: the start of the time period (datetime)
@param end: the end of the time period (datetime)
@param interval: time interval expression, like "days" or "2 weeks"'

@staticmethod
def get_rule(start, end, interval):

    match = re.match('\\s*(\\d*)\\s*([hdwmy]{1}).*', interval)
    if match:
        (num, delta) = match.groups()
        deltas = {'h': HOURLY, 'd': DAILY, 'w': WEEKLY, 'm': MONTHLY, 'y': YEARLY}
        if (delta not in deltas):
            return None
        else:
            num = (int(num) if num else 1)
            return rrule(deltas[delta], dtstart=start, until=end, interval=num)
    else:
        return None
