def create_operation(cls, a, b):
    """Create operation between a and b, merging if a or b is already an operation of same class
    """
    operands = []
    operands.extend(a.operands if isinstance(a, cls) else [a])
    operands.extend(b.operands if isinstance(b, cls) else [b])
    return cls(*operands)