How do I apply two periodic boundary conditions?

I need to set periodic boundary conditions in two places. I know how to install one, but two don’t work. Thank you.

class PeriodicBoundary(SubDomain):

    def inside(self, x, on_boundary):
        return bool((x[1] < DOLFIN_EPS or x[1] > (0.0002 - DOLFIN_EPS)))


    def map(self, x, y):
        y[0] = x[0] 
        y[1] = x[1] - 0.0002
        y[2] = x[2] 
        
class PeriodicBoundary_2(SubDomain):

    def inside(self, x, on_boundary):
        return bool((x[1] < (0.0014 - DOLFIN_EPS) or x[1] > (0.0012 + DOLFIN_EPS)))


    def map(self, x, y):
        y[0] = x[0] 
        y[1] = x[1] + 0.0002
        y[2] = x[2] 

pbc = PeriodicBoundary()   
pbc_2 = PeriodicBoundary_2()    
       
V = VectorFunctionSpace(mesh, "P", 2, constrained_domain=[pbc, pbc_2])
P = FunctionSpace(mesh, "P", 1)

Combine them into once, as for instance shown in: