'Return the partition as a dictionary whose keys are the
partition integers and the values are the multiplicity of that
integer.
Examples
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> IntegerPartition([1]*3 + [2] + [3]*4).as_dict()
{1: 3, 2: 1, 3: 4}'

def as_dict(self):

    if (self._dict is None):
        groups = group(self.partition, multiple=False)
        self._keys = [g[0] for g in groups]
        self._dict = dict(groups)
    return self._dict
