class_docstr: ExternalSorter will divide the elements into chunks, sort them in
  memory and dump them into disks, finally merge them back.
  
  The spilling will only happen when the used memory goes above
  the limit.
  
  Examples
  --------
  >>> sorter = ExternalSorter(1)  # 1M
  >>> import random
  >>> l = list(range(1024))
  >>> random.shuffle(l)
  >>> sorted(l) == list(sorter.sorted(l))
  True
  >>> sorted(l) == list(sorter.sorted(l, key=lambda x: -x, reverse=True))
  True
class_docstr_tok: ["ExternalSorter","will","divide","the","elements","into","chunks",",","sort","them","in","memory","and","dump","them","into","disks",",","finally","merge","them","back",".","The","spilling","will","only","happen","when","the","used","memory","goes","above","the","limit",".","Examples","--","--","--","--",">",">",">","sorter","=","ExternalSorter","(","1",")","#","1M",">",">",">","import","random",">",">",">","l","=","list","(","range","(","1024",")",")",">",">",">","random.shuffle","(","l",")",">",">",">","sorted","(","l",")","==","list","(","sorter.sorted","(","l",")",")","True",">",">",">","sorted","(","l",")","==","list","(","sorter.sorted","(","l",",","key=lambda","x",":","-x",",","reverse=True",")",")","True"]
docstr: Return the next memory limit. If the memory is not released
  after spilling, it will dump the data only when the used memory
  starts to increase.
docstr_tok: ["Return","the","next","memory","limit",".","If","the","memory","is","not","released","after","spilling",",","it","will","dump","the","data","only","when","the","used","memory","starts","to","increase","."]
code: def _next_limit(self):
      """
      Return the next memory limit. If the memory is not released
      after spilling, it will dump the data only when the used memory
      starts to increase.
      """
      return max(self.memory_limit, get_used_memory() * 1.05)
  
imports: import os
  import platform
  import shutil
  import warnings
  import gc
  import itertools
  import operator
  import random
  import sys
  import heapq
  from pyspark.serializers import BatchedSerializer, CPickleSerializer, FlattenedValuesSerializer, CompressedSerializer, AutoBatchedSerializer
  from pyspark.util import fail_on_stopiteration
label_desc: Use image node_id 3 for calling the ExternalSorter obj's underlying member method code with example usage: obj._next_limit() and returns: max