'Helper method to sanitize the data received by read_group. The None
values are converted to False, and the date/datetime are formatted,
and corrected according to the timezones.'

@api.model
def _read_group_prepare_data(self, key, value, groupby_dict):

    value = (False if (value is None) else value)
    gb = groupby_dict.get(key)
    if (gb and (gb['type'] in ('date', 'datetime')) and value):
        if isinstance(value, basestring):
            dt_format = (DEFAULT_SERVER_DATETIME_FORMAT if (gb['type'] == 'datetime') else DEFAULT_SERVER_DATE_FORMAT)
            value = datetime.datetime.strptime(value, dt_format)
        if gb['tz_convert']:
            value = pytz.timezone(self._context['tz']).localize(value)
    return value
