class_docstr: This class represents an integer partition.
  
  Explanation
  ===========
  
  In number theory and combinatorics, a partition of a positive integer,
  ``n``, also called an integer partition, is a way of writing ``n`` as a
  list of positive integers that sum to n. Two partitions that differ only
  in the order of summands are considered to be the same partition; if order
  matters then the partitions are referred to as compositions. For example,
  4 has five partitions: [4], [3, 1], [2, 2], [2, 1, 1], and [1, 1, 1, 1];
  the compositions [1, 2, 1] and [1, 1, 2] are the same as partition
  [2, 1, 1].
  
  See Also
  ========
  
  sympy.utilities.iterables.partitions,
  sympy.utilities.iterables.multiset_partitions
  
  References
  ==========
  
  .. [1] https://en.wikipedia.org/wiki/Partition_%28number_theory%29
docstr: Return the next partition of the integer, n, in lexical order,
  wrapping around to [n] if the partition is [1, ..., 1].
  
  Examples
  ========
  
  >>> from sympy.combinatorics.partitions import IntegerPartition
  >>> p = IntegerPartition([3, 1])
  >>> print(p.next_lex())
  [4]
  >>> p.partition < p.next_lex().partition
  True
code: def next_lex(self):
      """Return the next partition of the integer, n, in lexical order,
      wrapping around to [n] if the partition is [1, ..., 1].
  
      Examples
      ========
  
      >>> from sympy.combinatorics.partitions import IntegerPartition
      >>> p = IntegerPartition([3, 1])
      >>> print(p.next_lex())
      [4]
      >>> p.partition < p.next_lex().partition
      True
      """
      d = defaultdict(int)
      d.update(self.as_dict())
      key = self._keys
      a = key[-1]
      if a == self.integer:
          d.clear()
          d[1] = self.integer
      elif a == 1:
          if d[a] > 1:
              d[a + 1] += 1
              d[a] -= 2
          else:
              b = key[-2]
              d[b + 1] += 1
              d[1] = (d[b] - 1) * b
              d[b] = 0
      else:
          if d[a] > 1:
              if len(key) == 1:
                  d.clear()
                  d[a + 1] = 1
                  d[1] = self.integer - a - 1
              else:
                  a1 = a + 1
                  d[a1] += 1
                  d[1] = d[a] * a - a1
                  d[a] = 0
          else:
              b = key[-2]
              b1 = b + 1
              d[b1] += 1
              need = d[b] * b + d[a] * a - b1
              d[a] = d[b] = 0
              d[1] = need
      return IntegerPartition(self.integer, d)
  
imports: from sympy.core import Basic, Dict, sympify, Tuple
  from sympy.core.numbers import Integer
  from sympy.core.sorting import default_sort_key
  from sympy.core.sympify import _sympify
  from sympy.functions.combinatorial.numbers import bell
  from sympy.matrices import zeros
  from sympy.sets.sets import FiniteSet, Union
  from sympy.utilities.iterables import flatten, group
  from sympy.utilities.misc import as_int
  from collections import defaultdict
label_desc: Use image node_id 3 for calling the IntegerPartition obj's underlying member method code with example usage: obj.next_lex() and returns: IntegerPartition