python: return None if PY_IMPORT_STRING returns NULL
PY_IMPORT_STRING might return NULL on python 3 if, ie, a string can't be encoded. We should check for this and return None, rather than returning NULL. Fixes a NULL pointer dereference when reporting an error with an invalid string.