def to_dict(self):
        out = {}
        for k, v in iteritems(self._d_):
            try:
                f = self._doc_type.mapping[k]
                if f._coerce:
                    v = f.serialize(v)
            except __HOLE__:
                pass

            # don't serialize empty values
            # careful not to include numeric zeros
            if v in ([], {}, None):
                continue

            out[k] = v
        return out
dataset/ETHPy150Open elastic/elasticsearch-dsl-py/elasticsearch_dsl/utils.py/ObjectBase.to_dict