def cancel(batch_fn, cancel_fn, ops):
<EOL>canceled_ops = []<EOL>error_messages = []<EOL>max_batch = <NUM_LIT><EOL>total_ops = len(ops)<EOL>for first_op in range(<NUM_LIT:0>, total_ops, max_batch):<EOL><INDENT>batch_canceled, batch_messages = _cancel_batch(<EOL>batch_fn, cancel_fn, ops[first_op:first_op + max_batch])<EOL>canceled_ops.extend(batch_canceled)<EOL>error_messages.extend(batch_messages)<EOL><DEDENT>return canceled_ops, error_messages<EOL>
Cancel operations.

    Args:
      batch_fn: API-specific batch function.
      cancel_fn: API-specific cancel function.
      ops: A list of operations to cancel.

    Returns:
      A list of operations canceled and a list of error messages.