strutils: Allow safe_{encode,decode} to take bytes as input

In Python 3, passing "b'foo'" to safe_{encode,decode} currently fails. This
patch fixes this issue.

Change-Id: I01a5312700be80f353725fdf13de6413c4eb86f3
Merge "strutils: Allow safe_{encode,decode} to take bytes as input"