diff --git a/django/core/serializers/pyyaml.py b/django/core/serializers/pyyaml.py
index 5effda5..b983c75 100644
--- a/django/core/serializers/pyyaml.py
+++ b/django/core/serializers/pyyaml.py
@@ -6,7 +6,7 @@ Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
 
 import decimal
 import yaml
-from io import BytesIO
+from io import BytesIO, StringIO
 
 from django.db import models
 from django.core.serializers.base import DeserializationError
@@ -48,8 +48,10 @@ def Deserializer(stream_or_string, **options):
     """
     Deserialize a stream or string of YAML data.
     """
-    if isinstance(stream_or_string, basestring):
+    if isinstance(stream_or_string, str):
         stream = BytesIO(stream_or_string)
+    elif isinstance(stream_or_string, unicode):
+	stream = StringIO(stream_or_string)
     else:
         stream = stream_or_string
     try:
