functions: Fixed Python 3 compatibility

unicode doesn't exist anymore in Python 3 and the alternative for checking
for string types would be http://pythonhosted.org/six/#six.string_types
which would introduce an unnecessary dependency.