'This function convert date_histogram aggs to datetime'

def fix_aggs(self):

    aggs = self.aggs
    for key in list(aggs.keys()):
        _type = aggs[key].get('_type', 'unknown')
        if (_type == 'date_histogram'):
            for entry in aggs[key].get('entries', []):
                for (k, v) in list(entry.items()):
                    if (k in ['count', 'max', 'min', 'total_count', 'mean', 'total']):
                        continue
                    if (not isinstance(entry[k], datetime)):
                        entry[k] = datetime.utcfromtimestamp((v / 1000.0))
