'Format and localize some dates to be used in email templates
:param string interval: Among \'day\', \'month\', \'dayname\' and \'time\' indicating the desired formatting
:param string tz: Timezone indicator (optional)
:return unicode: Formatted date or time (as unicode string, to prevent jinja2 crash)'

@api.multi
def get_interval(self, interval, tz=None):

    self.ensure_one()
    date = fields.Datetime.from_string(self.start)
    if tz:
        timezone = pytz.timezone((tz or 'UTC'))
        date = date.replace(tzinfo=pytz.timezone('UTC')).astimezone(timezone)
    if (interval == 'day'):
        result = unicode(date.day)
    elif (interval == 'month'):
        result = babel.dates.format_date(date=date, format='MMMM    y', locale=(self._context.get('lang') or 'en_US'))
    elif (interval == 'dayname'):
        result = babel.dates.format_date(date=date, format='EEEE', locale=(self._context.get('lang') or 'en_US'))
    elif (interval == 'time'):
        (dummy, format_time) = self._get_date_formats()
        result = tools.ustr(date.strftime((format_time + '    %Z')))
    return result
