Check if input timestamp is in rrule+duration period

    :param rrule: rrule to check
    :type rrule: str or dict
        (freq, dtstart, interval, count, wkst, until, bymonth, byminute, etc.)
    :param dict duration: time duration from rrule step. Ex:{'minutes': 60}
    :param float timestamp: timestamp to check between rrule+duration. If None,
        use now

def during(rrule, duration=None, timestamp=None, **kwargs):
    """
    Check if input timestamp is in rrule+duration period

    :param rrule: rrule to check
    :type rrule: str or dict
        (freq, dtstart, interval, count, wkst, until, bymonth, byminute, etc.)
    :param dict duration: time duration from rrule step. Ex:{'minutes': 60}
    :param float timestamp: timestamp to check between rrule+duration. If None,
        use now
    """

    result = False

    # if rrule is a string expression
    if isinstance(rrule, string_types):
        rrule_object = rrule_class.rrulestr(rrule)

    else:
        rrule_object = rrule_class(**rrule)

    # if timestamp is None, use now
    if timestamp is None:
        timestamp = time()

    # get now object
    now = datetime.fromtimestamp(timestamp)

    # get delta object
    duration_delta = now if duration is None else relativedelta(**duration)

    # get last date
    last_date = rrule_object.before(now, inc=True)

    # if a previous date exists
    if last_date is not None:
        next_date = last_date + duration_delta

        # check if now is between last_date and next_date
        result = last_date <= now <= next_date

    return result