Python 3 compatibility
cast field.values to list to prevent error:
TypeError: 'dict_values' object does not support indexing

set basestring = (str, bytes) to fix:
NameError: global name 'basestring' is not defined