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 previous partition of the integer, n, in lexical order,
  wrapping around to [1, ..., 1] if the partition is [n].
  
  Examples
  ========
  
  >>> from sympy.combinatorics.partitions import IntegerPartition
  >>> p = IntegerPartition([4])
  >>> print(p.prev_lex())
  [3, 1]
  >>> p.partition > p.prev_lex().partition
  True
code: def prev_lex(self):
      """Return the previous partition of the integer, n, in lexical order,
      wrapping around to [1, ..., 1] if the partition is [n].
  
      Examples
      ========
  
      >>> from sympy.combinatorics.partitions import IntegerPartition
      >>> p = IntegerPartition([4])
      >>> print(p.prev_lex())
      [3, 1]
      >>> p.partition > p.prev_lex().partition
      True
      """
      d = defaultdict(int)
      d.update(self.as_dict())
      keys = self._keys
      if keys == [1]:
          return IntegerPartition({self.integer: 1})
      if keys[-1] != 1:
          d[keys[-1]] -= 1
          if keys[-1] == 2:
              d[1] = 2
          else:
              d[keys[-1] - 1] = d[1] = 1
      else:
          d[keys[-2]] -= 1
          left = d[1] + keys[-2]
          new = keys[-2]
          d[1] = 0
          while left:
              new -= 1
              if left - new >= 0:
                  d[new] += left // new
                  left -= d[new] * new
      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 2 for calling the IntegerPartition obj's underlying member method code with example usage: obj.prev_lex() and returns: IntegerPartition, IntegerPartition