'Return the last date a recurring event happens, according to its end_type.'

@api.multi
def _get_recurrency_end_date(self):

    self.ensure_one()
    data = self.read(['final_date', 'recurrency', 'rrule_type', 'count', 'end_type', 'stop', 'interval'])[0]
    if (not data.get('recurrency')):
        return False
    end_type = data.get('end_type')
    final_date = data.get('final_date')
    if ((end_type == 'count') and all((data.get(key) for key in ['count', 'rrule_type', 'stop', 'interval']))):
        count = ((data['count'] + 1) * data['interval'])
        (delay, mult) = {'daily': ('days', 1), 'weekly': ('days', 7), 'monthly': ('months', 1), 'yearly': ('years', 1)}[data['rrule_type']]
        deadline = fields.Datetime.from_string(data['stop'])
        return (deadline + relativedelta(**{delay: (count * mult)}))
    return final_date
