def mat_add_flat(lh, rh):
    if ((hasattr(lh, 'is_MatAdd') and lh.is_MatAdd) or (hasattr(rh, 'is_MatAdd') and rh.is_MatAdd)):
        args = []
        if (hasattr(lh, 'is_MatAdd') and lh.is_MatAdd):
            args += list(lh.args)
        else:
            args += [lh]
        if (hasattr(rh, 'is_MatAdd') and rh.is_MatAdd):
            args = (args + list(rh.args))
        else:
            args += [rh]
        return sympy.MatAdd(*args, evaluate=False)
    else:
        return sympy.MatAdd(lh, rh, evaluate=False)
def mat_add_flat(lh, rh):
    if ((hasattr(lh, 'is_MatAdd') and lh.is_MatAdd) or (hasattr(rh, 'is_MatAdd') and rh.is_MatAdd)):
        args = []
        if (hasattr(lh, 'is_MatAdd') and lh.is_MatAdd):
            args += list(lh.args)
        else:
            args += [lh]
        if (hasattr(rh, 'is_MatAdd') and rh.is_MatAdd):
            args = (args + list(rh.args))
        else:
            args += [rh]
        return sympy.MatAdd(*args, evaluate=False)
    else:
        return sympy.MatAdd(lh, rh, evaluate=False)