Extract subdomains from the whole domain

hello, I have already a rectangular domain of size 2x2 with holes inside created in the .xml format. But I only want to solve the PDE on the some rectangular parts of this domain of size 0.5x0.5. So I used the code below but it has error “‘Omega_0’ object has no attribute ‘topology’”. Is anyone know what the problem is and how to realize my aim. Thank you very much in advance.

mesh = Mesh("mesh.xml")
subdomains = MeshFunction("size_t", mesh, "mesh_physical_region.xml")
File("subdomains.pvd") << subdomains

tol = 1E-14
class Omega_0(SubDomain):
    def inside(self, x, on_boundary):
        return 0.25 + tol <= x[0] and  x[0]<= 0.75 + tol and 0.25 + tol <= x[1] and x[0] <= 0.75 + tol

subdomain_0 = Omega_0()
subdomain_0_domain = MeshFunction('size_t', subdomain_0, subdomain_0.topology().dim(), 0)
File("subdomain_0.pvd") << subdomain_0_domain

Use mesh.topology().dim() as a SubDomain does not have a topology