def _sparse_array_op(<EOL>left: ABCSparseArray,<EOL>right: ABCSparseArray,<EOL>op: Callable,<EOL>name: str<EOL>) -> Any:
if name.startswith('<STR_LIT>'):<EOL><INDENT>name = name[<NUM_LIT:2>:-<NUM_LIT:2>]<EOL><DEDENT>ltype = left.dtype.subtype<EOL>rtype = right.dtype.subtype<EOL>if not is_dtype_equal(ltype, rtype):<EOL><INDENT>subtype = find_common_type([ltype, rtype])<EOL>ltype = SparseDtype(subtype, left.fill_value)<EOL>rtype = SparseDtype(subtype, right.fill_value)<EOL>left = left.astype(ltype)<EOL>right = right.astype(rtype)<EOL>dtype = ltype.subtype<EOL><DEDENT>else:<EOL><INDENT>dtype = ltype<EOL><DEDENT>result_dtype = None<EOL>if left.sp_index.ngaps == <NUM_LIT:0> or right.sp_index.ngaps == <NUM_LIT:0>:<EOL><INDENT>with np.errstate(all='<STR_LIT:ignore>'):<EOL><INDENT>result = op(left.get_values(), right.get_values())<EOL>fill = op(_get_fill(left), _get_fill(right))<EOL><DEDENT>if left.sp_index.ngaps == <NUM_LIT:0>:<EOL><INDENT>index = left.sp_index<EOL><DEDENT>else:<EOL><INDENT>index = right.sp_index<EOL><DEDENT><DEDENT>elif left.sp_index.equals(right.sp_index):<EOL><INDENT>with np.errstate(all='<STR_LIT:ignore>'):<EOL><INDENT>result = op(left.sp_values, right.sp_values)<EOL>fill = op(_get_fill(left), _get_fill(right))<EOL><DEDENT>index = left.sp_index<EOL><DEDENT>else:<EOL><INDENT>if name[<NUM_LIT:0>] == '<STR_LIT:r>':<EOL><INDENT>left, right = right, left<EOL>name = name[<NUM_LIT:1>:]<EOL><DEDENT>if name in ('<STR_LIT>', '<STR_LIT>') and dtype == '<STR_LIT:bool>':<EOL><INDENT>opname = '<STR_LIT>'.format(name=name)<EOL>left_sp_values = left.sp_values.view(np.uint8)<EOL>right_sp_values = right.sp_values.view(np.uint8)<EOL>result_dtype = np.bool<EOL><DEDENT>else:<EOL><INDENT>opname = '<STR_LIT>'.format(name=name, dtype=dtype)<EOL>left_sp_values = left.sp_values<EOL>right_sp_values = right.sp_values<EOL><DEDENT>sparse_op = getattr(splib, opname)<EOL>with np.errstate(all='<STR_LIT:ignore>'):<EOL><INDENT>result, index, fill = sparse_op(<EOL>left_sp_values, left.sp_index, left.fill_value,<EOL>right_sp_values, right.sp_index, right.fill_value)<EOL><DEDENT><DEDENT>if result_dtype is None:<EOL><INDENT>result_dtype = result.dtype<EOL><DEDENT>return _wrap_result(name, result, index, fill, dtype=result_dtype)<EOL>
Perform a binary operation between two arrays.

Parameters
----------
left : Union[SparseArray, ndarray]
right : Union[SparseArray, ndarray]
op : Callable
    The binary operation to perform
name str
    Name of the callable.

Returns
-------
SparseArray