'Represent the date according to deployment settings &/or T()
@param dt: the date (datetime.date or datetime.datetime)
@param format: the format (overrides deployment setting)
@param utc: the date is given in UTC
@param calendar: the calendar to use (defaults to current.calendar)'

@classmethod
def date_represent(cls, dt, format=None, utc=False, calendar=None):

    if (not format):
        format = current.deployment_settings.get_L10n_date_format()
    if (calendar is None):
        calendar = current.calendar
    elif isinstance(calendar, basestring):
        calendar = S3Calendar(calendar)
    if dt:
        if utc:
            offset = cls.get_offset_value(current.session.s3.utc_offset)
            if offset:
                delta = datetime.timedelta(seconds=offset)
                if (not isinstance(dt, datetime.datetime)):
                    combine = datetime.datetime.combine
                    bp = (combine(dt, datetime.time(8, 0, 0)) - delta).time()
                    dt = combine(dt, bp)
                dt = (dt + delta)
        dtstr = calendar.format_date(dt, dtfmt=format, local=True)
    else:
        dtstr = current.messages['NONE']
    return dtstr
