def periodic(scheduler, interval, priority, action, actionargs=[],
             do_now=True):
    """periodic.
    runs a function periodically using sched module

    :param scheduler:
    :param interval:
    :param priority:
    :param action:
    :param actionargs:
    :param do_now: whether to run at very start or wait for interval

    """

    event = scheduler.enter(interval, priority, periodic,
                            (scheduler, interval, priority,
                             action, actionargs))
    if do_now:
        action(*actionargs)
    return event