def METHOD_NAME(tdim):
    if tdim == 3:
        mesh = create_unit_cube(MPI.COMM_WORLD, 2, 3, 5, CellType.tetrahedron, ghost_mode=GhostMode.none)
    else:
        mesh = create_unit_square(MPI.COMM_WORLD, 2, 5, CellType.triangle, ghost_mode=GhostMode.none)
    mesh.topology.create_entities(tdim - 1)
    mesh.topology.create_connectivity(tdim - 1, tdim)
    mesh.topology.create_entities(1)
    f_to_c = mesh.topology.connectivity(tdim - 1, tdim)
    facet_indices = []
    for f in range(mesh.topology.index_map(tdim - 1).size_local):
        if len(f_to_c.links(f)) == 1:
            facet_indices += [f]
    meshtag = meshtags(mesh, tdim - 1, numpy.array(facet_indices, dtype=numpy.int32),
                       numpy.arange(len(facet_indices), dtype=numpy.int32))
    fine_mesh, parent_cell, parent_facet = refine_plaza(mesh, False, RefinementOption.parent_cell_and_facet)
    fine_mesh.topology.create_entities(tdim - 1)
    new_meshtag = transfer_meshtag(meshtag, fine_mesh, parent_cell, parent_facet)
    assert len(new_meshtag.indices) == (tdim * 2 - 2) * len(meshtag.indices)
    # New tags should be on facets with one cell (i.e. exterior)
    fine_mesh.topology.create_connectivity(tdim - 1, tdim)
    new_f_to_c = fine_mesh.topology.connectivity(tdim - 1, tdim)
    for f in new_meshtag.indices:
        assert len(new_f_to_c.links(f)) == 1
    # Now mark all facets (including internal)
    facet_indices = numpy.arange(mesh.topology.index_map(tdim - 1).size_local)
    meshtag = meshtags(mesh, tdim - 1, numpy.array(facet_indices, dtype=numpy.int32),
                       numpy.arange(len(facet_indices), dtype=numpy.int32))
    new_meshtag = transfer_meshtag(meshtag, fine_mesh, parent_cell, parent_facet)
    assert len(new_meshtag.indices) == (tdim * 2 - 2) * len(meshtag.indices)