Another way to do this (which may be more convenient if the internal border doesn't have such a simple analytic expression) is to define the subdomains in Gmsh as 'Physical Surfaces'.  These can then be accessed using the cell_subset method of the Mesh and passed to the subset keyword-argument of interpolate.
  I attach a minimal example which seems to do the same thing as the FEniCS piecewise.py.