<s> from __future__ import unicode_literals <EOL> from dateutil . relativedelta import relativedelta <EOL> from billy . models . plan import PlanModel <EOL> def next_transaction_datetime ( started_at , frequency , period , interval = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> if interval < <NUM_LIT:1> : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> if period == <NUM_LIT:0> : <EOL> return started_at <EOL> delta = None <EOL> if frequency == PlanModel . frequencies . DAILY : <EOL> delta = relativedelta ( days = period * interval ) <EOL> elif frequency == PlanModel . frequencies . WEEKLY : <EOL> delta = relativedelta ( weeks = period * interval ) <EOL> elif frequency == PlanModel . frequencies . MONTHLY : <EOL> delta = relativedelta ( months = period * interval ) <EOL> elif frequency == PlanModel . frequencies . YEARLY : <EOL> delta = relativedelta ( years = period * interval ) <EOL> return started_at + delta </s>
