This answer will be a bit incomplete, but I think you can work out the full details from it (feedback is welcome).
Consider you have the solid torus with the torus shaped hole winding ally around it twice, and call this space $X$, then you want to calculate $\pi_1(Z)$, where $\frac{X}{Y_1\sim_f Y_2}$, $Y_1,Y_2$ are the connected components of $\partial X$ and $f:Y_1\to Y_2$ is a homeomorphism. Now, with the notation out of the way, cover $Z$ with two open sets (Van Kampen in the making) $U,V$, where $U = \mathrm{Int} X$, and $V$ is the quotient (by the relation $\sim_f$) of an open neighborhood of $\partial X$; further, since $U\cap V$ is not connected, we are gonna have to use the groupoid version of the Van Kampen theorem.
So choose two points in $U \cap V$, which I will call $0$ and $1$ because I don't want to use more letters, and we calculate the fundamental groupoids of $U,V$ and $U\cap V$, with respect to the set of basepoints $\{0,1\}$. Each of these groupoids has two elements, and all we need to determine is the automorphism group of these two elements (corresponding to $0$ and $1$) and the morphisms between them (if they exist).
For $\pi_1(U\cap V,\{0,1\})$, each element only has the fundamental group of the torus (\mathbb Z \oplus \mathbb Z) as it's automorphism group, and since $0$ and $1$ lie in different components of $U\cap V$ there are no morphisms (which correspond to paths) between them.
For $\pi_1(V,\{0,1\})$, you can see that since $V$ deformation-retracts to the boundary of $X$ under the identification $\sim_f$. Further, you get that, once again, under this identification the boundary of $X$ is homeomorphic to the torus, and so $\hom(0,0) = \hom(1,1) = \pi_1(V) = \mathbb Z \times \mathbb Z$. Also, by choosing the base-points $0$ and $1$ such that $1 \in r^{-1}(f\circ r (0))$, one can see that all elements of $\hom(0,1)$ are of the form $\circ \gamma_{0,1} \circ k_0$, where $\gamma_{0,1}$ is a path from $0$ to $1$ and $k_0$ is an element of $\hom(0,0)$ (note that $\gamma_{0,1}\circ k_0 = h(k_0)\circ\gamma_{0,1}$ where $h$ is the "identity" $\hom(0,0) = \hom(1,1)$.
Finally (we still have to see what are the maps, but, we're almost there) for $\pi_1(U,\{0,1\})$, we can see that $U$ deformation-retracts to a torus with a Möbius band inside it, and so has its fundamental group given by $\pi_1(X) = \frac{\mathbb Za + \mathbb Zb + \mathbb Zc}{2a + b \sim 2c}$ (there is a mistake in my comment before, sorry about that). And once again, $\hom(0,0) = \hom(1,1) = \pi_1(X)$ and $\hom(0,1)$ has elements of the form $\delta_{0,1}\circ k_0$.
Now, all that is left is to assemble the pieces by choosing a point, (either $0$ or $1$, I will choose $0$).
The map $\pi_1(U\cap V,0)\to \pi_1(V,0)$ is the identitiy
The map $\pi_1(U\cap V,0)\to \pi_1(U,0)$ takes one generator to $a$ and the other generator to $b$, as per the representation given above (note that I am assuming $0$ is the point "close to the outer boundary of $X$")
Finally, we need to consider the group elements that arise from composing elemnts of $\hom(0,1)$ with elements of $\hom(1,0)$, these will have the form $\delta^{-1}\circ\gamma$ which is not homotopy equivalent to any of the other generators.
So, we get $\pi_1(Z) = \frac{\mathbb Za + \mathbb Zb + \mathbb Zc + \mathbb Z(\delta^{-1}\gamma)}{2a + b \sim 2c}$
In the previous case the worm just was doing a loop inside the torus and reaching the same place where it began.
In the third case the worm does a loop again the torus but does not finish at the same place, so it does another loop and now it finishes at the place it began. I'll post a picture if I'm able to.
– DCao Apr 15 '15 at 22:28I also can ''imagine'' the retraction you tell me about, but I do not see why it is usefull if you identify borders later. I mean, the fundamental group of $X$ is the same that on a retract of $X$, but in our case we do a quotient after so I do not see the relationship. Maybe there is some staff I do not know like ''a quotient of a retract of $X$ is a retract of the quotient of $X$''? (I do not mean the last sentence to be true, just an example).
– DCao Apr 15 '15 at 23:01