'Compute buckets for the fours sets of parameters.
We guarantee that any two equal Mod objects returned are actually the
same, and that the buckets are sorted by real part (an and bq
descendending, bm and ap ascending).
Examples
>>> from sympy.simplify.hyperexpand import G_Function
>>> from sympy.abc import y
>>> from sympy import S, symbols
>>> a, b = [1, 3, 2, S(3)/2], [1 + y, y, 2, y + 3]
>>> G_Function(a, b, [2], [y]).compute_buckets()
({0: [3, 2, 1], 1/2: [3/2]},
{0: [2], y: [y, y + 1, y + 3]}, {0: [2]}, {y: [y]})'

def compute_buckets(self):

    dicts = (pan, pap, pbm, pbq) = [defaultdict(list) for i in range(4)]
    for (dic, lis) in zip(dicts, (self.an, self.ap, self.bm, self.bq)):
        for x in lis:
            dic[_mod1(x)].append(x)
    for (dic, flip) in zip(dicts, (True, False, False, True)):
        for (m, items) in dic.items():
            x0 = items[0]
            items.sort(key=(lambda x: (x - x0)), reverse=flip)
            dic[m] = items
    return tuple([dict(w) for w in dicts])
