Evaluate an indefinite integral Find the value of 
$$\int{\frac{x^2e^x}{(x+2)^2}} dx$$
My Attempt: I tried to arrange the numerator as follows:
$$ e^xx^2 =  e^x(x+2-2)^2 $$ but that didn't help.
Any guidance on this problem will be very helpful.

Another approach, let $u \mapsto x+2$ and expand
\begin{align*}
\int \frac{x^2e^x}{(x+2)^2}dx &= e^{-2} \int \frac{(u-2)^2 e^u}{u^2} \,du \\
 &= e^{-2} \int \left( \frac{4e^u}{u^2} - \frac{4e^u}{u} + e^u \right) \, du \\ 
 &= e^{-2} \left( \int e^u \,du -4 \int \frac{e^u}{u} - \frac{e^u}{u^2}\, du \right) \\ 
\end{align*}
now for the second integral, integrate each term by parts, $f_0=e^u$, $dg_0=u^{-2}$ and $f_1 = -u^{-1}$, $dg_1 = e^u$,
$$ = e^{-2} \left( e^u - \frac{4e^u}{u} \right) +c$$
$$ = e^{u-2} - \frac{4e^{u-2}}{u} +c$$
and substitute back in
$$ = e^x - \frac{4e^x}{x+2} +c$$
$$ = \frac{(x-2)e^x}{x+2} +c$$
