If you take a pill that you think is percoset and it ends up being fentanyl, you didn’t acquire it legally.
I guess so, I didn't think of it that way...
It is illegal without a proper doctor's prescription and if it's obtained illicitly (Fentanyl that looks like Percoset being a thing the Mexican cartels do[1]).