                      try:
                          default_manager = model._default_manager
                          field_name = field.remote_field.field_name
                          if hasattr(default_manager, 'get_by_natural_key'):
                              if hasattr(field_value, '__iter__') and not isinstance(field_value, six.text_type):
                                  obj = default_manager.db_manager(db).get_by_natural_key(*field_value)
                                  value = getattr(obj, field.remote_field.field_name)
                                  # If this is a natural foreign key to an object that
                                  # has a FK/O2O as the foreign key, use the FK value
                                  if model._meta.pk.remote_field:
 
</s> remove         if value and isinstance(value, six.string_types):
 </s> add         if value and isinstance(value, str): </s> remove         elif f.geom_type == 'RASTER' and isinstance(value, six.string_types):
 </s> add         elif f.geom_type == 'RASTER' and isinstance(value, str): </s> remove         if isinstance(index, six.string_types):
 </s> add         if isinstance(index, str): </s> remove                         if hasattr(value, '__iter__') and not isinstance(value, six.text_type):
 </s> add                         if hasattr(value, '__iter__') and not isinstance(value, str): </s> remove         if value and isinstance(value, six.string_types):
 </s> add         if value and isinstance(value, str):
                            if hasattr(field_value, '__iter__') and not isinstance(field_value, str):
                      try:
                          default_manager = model._default_manager
                          field_name = field.remote_field.field_name
                          if hasattr(default_manager, 'get_by_natural_key'):
                            if hasattr(field_value, '__iter__') and not isinstance(field_value, str):
                                  obj = default_manager.db_manager(db).get_by_natural_key(*field_value)
                                  value = getattr(obj, field.remote_field.field_name)
                                  # If this is a natural foreign key to an object that
                                  # has a FK/O2O as the foreign key, use the FK value
                                  if model._meta.pk.remote_field:
keep keep keep keep replace keep keep keep keep keep
 Refs #23919 -- Removed six.<various>_types usage

Thanks Tim Graham and Simon Charette for the reviews. 
django/core/serializers/python.py