MixedFunctionSpace with Space on the boundary

Hello,
I want to create a mixed Function Space where one space is only defined on a part of the boundary (in order to include boundary conditions weakly). For example, I want to do something like this:

from dolfin import *

mesh = UnitSquareMesh(2,2)
Mesh0 = BoundaryMesh(mesh, ‘exterior’)
class Top(SubDomain):
def inside(self,x,on_boundary):
return near(x[0], 0.0)
top = Top()
submesh = SubMesh(Mesh0,top)

Y1_elem = FiniteElement(‘P’,mesh.ufl_cell(),1)
Y2_elem = FiniteElement(‘DG’,submesh.ufl_cell(),1)
Y = FunctionSpace(mesh,[Y1_elem,Y2_elem])

Is there a possibility to circumvent these difficulties?
Kind regards, Johannes

See @cdaversin Mixed dimensional Finite element method (link to paper). There are many examples on this forum of usage, as well as on Zenodo