Given $[A,B]=0$ then $[A,f(B)]=0$ 
Given $A$ and $B$ two operators that commute ($[A,B]=0$) then $A$ commutes with an arbitrary function of $B$

I recently saw this property of the commutators on a quantum mechanics course. We didn't get any proof on the property and we didn't get told wether this propery is true for any function $f(B)$ or if it needs to fulfil some conditions.
I've tried to prove it on my own but I have no idea on how to approach the problem as I haven't taken any course on operator theory.
I'd appreciate if anyone could prove this here and if anyone could tell me if this is true for any function.
Thanks in advance.

I fear that by asking this here instead of PSE, you are inviting people to overthink it. Almost certainly your context assumes $f(x)$ is well behaved, analytic, etc, and is assumed to amount to its Taylor expansion around the origin. So, by linearity of the commutator, you are supposed to prove that
A commutes with all monomials $B^n$.
You can prove this by induction, given the identity
$$
[A,BC]=[A,B]C + B[A,C].
$$
Now take $C=B^n$ and apply induction.
It's not meant to be rocket science; this is a routine identity you'll be using more than once a week.
