'If timezone support is enabled, make an aware datetime object in UTC;
otherwise make a naive one in the local timezone.'

def _datetime_from_timestamp(self, ts):

    if settings.USE_TZ:
        return datetime.utcfromtimestamp(ts).replace(tzinfo=timezone.utc)
    else:
        return datetime.fromtimestamp(ts)
