code: def is_protected_type(obj):
      
      return isinstance(obj, six.integer_types + (type(None), float, Decimal,
          datetime.datetime, datetime.date, datetime.time))
docs: Determine if the object instance is of a protected type.
  
      Objects of protected types are preserved as-is when passed to
      force_text(strings_only=True).