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