'Encode the given object and yield each string
representation as available.
For example::
for chunk in JSONEncoder().iterencode(bigobject):
mysocket.write(chunk)'

def iterencode(self, o, _one_shot=False):

    if self.check_circular:
        markers = {}
    else:
        markers = None
    if self.ensure_ascii:
        _encoder = encode_basestring_ascii
    else:
        _encoder = encode_basestring
    if (self.encoding != 'utf-8'):
        def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):
            if isinstance(o, str):
                o = o.decode(_encoding)
            return _orig_encoder(o)
    def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=PosInf, _neginf=(- PosInf)):
        if (o != o):
            text = 'NaN'
        elif (o == _inf):
            text = 'Infinity'
        elif (o == _neginf):
            text = '-Infinity'
        else:
            return _repr(o)
        if (not allow_nan):
            raise ValueError(('Out    of    range    float    values    are    not    JSON    compliant:    ' + repr(o)))
        return text
    key_memo = {}
    if (_one_shot and (c_make_encoder is not None) and (not self.indent) and (not self.sort_keys)):
        _iterencode = c_make_encoder(markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, self.allow_nan, key_memo, self.use_decimal)
    else:
        _iterencode = _make_iterencode(markers, self.default, _encoder, self.indent, floatstr, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, _one_shot, self.use_decimal)
    try:
        return _iterencode(o, 0)
    finally:
        key_memo.clear()
