2. Find the function $f: \mathbf{R} \rightarrow \mathbf{R}$, such that for any real numbers $x, y$, we have
$$
f(f(x y))=|x| f(y)+3 f(x y) .
$$
(2015, Estonian Mathematical Olympiad)
By swapping $x$ and $y$ and respectively setting $x=1$, $x=y=1$, $y=f(1)$, we obtain
$$
\begin{array}{l}
f(y)=|y| f(1), f(f(1))=4 f(1), \\
f(f(1))=|f(1)| f(1) .
\end{array}
$$

The function can be solved as
$$
f(x)=0 \text { or } f(x)=4|x| \text { or } f(x)=-4|x| \text {. }
$$