human
I wrote the below code

    from sympy.concrete.summations import Sum
    from sympy import Mul
    def __refactor(val):
        args = Mul.make_args(val)
        sumv = next((x for x in args if isinstance(x, Sum)))
        constant = Mul(*[x for x in args if (x != sumv)])
        return Sum((constant * sumv.function), *sumv.limits)
    if isinstance(self, Mul):
        rself = __refactor(self)
    else:
        rself = self
    if isinstance(other, Mul):
        rother = __refactor(other)
    else:
        rother = other
    if (type(rself) == type(rother)):
        if (method == 0):
            if (rself.limits == rother.limits):
                return factor_sum(Sum((rself.function + rother.function), *rself.limits))
        elif (method == 1):
            if (simplify((rself.function - rother.function)) == 0):
                if (len(rself.limits) == len(rother.limits) == 1):
                    i = rself.limits[0][0]
                    x1 = rself.limits[0][1]
                    y1 = rself.limits[0][2]
                    j = rother.limits[0][0]
                    x2 = rother.limits[0][1]
                    y2 = rother.limits[0][2]
                    if (i == j):
                        if (x2 == (y1 + 1)):
                            return factor_sum(Sum(rself.function, (i, x1, y2)))
                        elif (x1 == (y2 + 1)):
                            return factor_sum(Sum(rself.function, (i, x2, y1)))
    return Add(self, other)

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def sum_add(self, other, method=0):