code: def json_encode(self, out, limit=None, sort_keys=False, indent=None):
          '''Encode the results of this paged response as JSON writing to the
          provided file-like `out` object. This function will iteratively read
          as many pages as present, streaming the contents out as JSON.
          :param file-like out: an object with a `write` function
          :param int limit: optional maximum number of items to write
          :param bool sort_keys: if True, output keys sorted, default is False
          :param bool indent: if True, indent output, default is False
          '''
          stream = self._json_stream(limit)
          enc = json.JSONEncoder(indent=indent, sort_keys=sort_keys)
          for chunk in enc.iterencode(stream):
              out.write(u'%s' % chunk)