static PyObject *bpy_bm_utils_vert_splice(PyObject *UNUSED(self), PyObject *args)
{
	BPy_BMVert *py_vert;
	BPy_BMVert *py_vert_target;

	BMesh *bm;

	bool ok;

	if (!PyArg_ParseTuple(args, "O!O!:vert_splice",
	                      &BPy_BMVert_Type, &py_vert,
	                      &BPy_BMVert_Type, &py_vert_target))
	{
		return NULL;
	}

	BPY_BM_CHECK_OBJ(py_vert);
	BPY_BM_CHECK_OBJ(py_vert_target);

	bm = py_vert->bm;
	BPY_BM_CHECK_SOURCE_OBJ(bm, "vert_splice", py_vert_target);

	if (py_vert->v == py_vert_target->v) {
		PyErr_SetString(PyExc_ValueError,
		                "vert_splice(...): vert arguments match");
		return NULL;
	}

	if (BM_edge_exists(py_vert->v, py_vert_target->v)) {
		PyErr_SetString(PyExc_ValueError,
		                "vert_splice(...): verts can't share an edge");
		return NULL;
	}

	if (BM_vert_pair_share_face_check(py_vert->v, py_vert_target->v)) {
		PyErr_SetString(PyExc_ValueError,
		                "vert_splice(...): verts can't share a face");
		return NULL;
	}

	/* should always succeed */
	ok = BM_vert_splice(bm, py_vert_target->v, py_vert->v);
	BLI_assert(ok == true);
	UNUSED_VARS_NDEBUG(ok);

	Py_RETURN_NONE;
}
static PyObject *bpy_bmeditselseq_add(BPy_BMEditSelSeq *self, BPy_BMElem *value)
{
	BPY_BM_CHECK_OBJ(self);

	if ((BPy_BMVert_Check(value) ||
	     BPy_BMEdge_Check(value) ||
	     BPy_BMFace_Check(value)) == FALSE)
	{
		PyErr_Format(PyExc_TypeError,
		             "Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name);
		return NULL;
	}

	BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "select_history.add()");

	BM_select_history_store(self->bm, value->ele);

	Py_RETURN_NONE;
}
static PyObject *bpy_bm_utils_face_vert_separate(PyObject *UNUSED(self), PyObject *args)
{
	BPy_BMFace *py_face;
	BPy_BMVert *py_vert;

	BMesh *bm;
	BMLoop *l;
	BMVert *v_old, *v_new;

	if (!PyArg_ParseTuple(args, "O!O!:face_vert_separate",
	                      &BPy_BMFace_Type, &py_face,
	                      &BPy_BMVert_Type, &py_vert))
	{
		return NULL;
	}

	bm = py_face->bm;

	BPY_BM_CHECK_OBJ(py_face);
	BPY_BM_CHECK_SOURCE_OBJ(bm, "face_vert_separate()", py_vert);

	l = BM_face_vert_share_loop(py_face->f, py_vert->v);

	if (l == NULL) {
		PyErr_SetString(PyExc_ValueError,
		                "vertex not found in face");
		return NULL;
	}

	v_old = l->v;
	v_new = BM_face_loop_separate(bm, l);

	if (v_new != v_old) {
		return BPy_BMVert_CreatePyObject(bm, v_new);
	}
	else {
		Py_RETURN_NONE;
	}
}
static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *value)
{
	BPY_BM_CHECK_OBJ(self);

	if ((BPy_BMVert_Check(value) ||
	     BPy_BMEdge_Check(value) ||
	     BPy_BMFace_Check(value)) == FALSE)
	{
		PyErr_Format(PyExc_TypeError,
		             "Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name);
		return NULL;
	}

	BPY_BM_CHECK_SOURCE_OBJ(value, self->bm, "select_history.remove()");

	if (BM_select_history_remove(self->bm, value->ele) == FALSE) {
		PyErr_SetString(PyExc_ValueError,
		                "Element not found in selection history");
		return NULL;
	}

	Py_RETURN_NONE;
}
static PyObject *bpy_bmlayeritem_copy_from(BPy_BMLayerItem *self, BPy_BMLayerItem *value)
{
	CustomData *data;

	if (!BPy_BMLayerItem_Check(value)) {
		PyErr_Format(PyExc_TypeError,
		             "layer.copy_from(x): expected BMLayerItem, not '%.200s'",
		             Py_TYPE(value)->tp_name);
		return NULL;
	}

	BPY_BM_CHECK_OBJ(self);
	BPY_BM_CHECK_SOURCE_OBJ(self->bm, "layer.copy_from()", value);

	if ((self->htype != value->htype) ||
	    (self->type  != value->type))
	{
		PyErr_SetString(PyExc_ValueError,
		                "layer.copy_from(other): layer type mismatch");
	}

	else if (self->index == value->index) {
		Py_RETURN_NONE;
	}

	data = bpy_bm_customdata_get(self->bm, self->htype);

	if ((bpy_bmlayeritem_get(self) == NULL) ||
	    (bpy_bmlayeritem_get(value) == NULL))
	{
		return NULL;
	}

	BM_data_layer_copy(self->bm, data, self->type, value->index, self->index);

	Py_RETURN_NONE;
}