Fixed userdata plugin return value for Python3

The comparison fails when ret_value is None in Python3.
This adds an extra check so that None will not be compared with an
integer.

Change-Id: Iddc6bbf42fc3215248d9187725a329181f2ba2fb