import six


def to_unicode(str_bytes_or_unicode):
  """Converts string types (str, bytes, or unicode) to unicode."""
  if isinstance(str_bytes_or_unicode, six.text_type):  # Remain unicode type.
    return str_bytes_or_unicode
  elif isinstance(str_bytes_or_unicode, six.binary_type):  # Binarny to unicode.
    return str_bytes_or_unicode.decode("utf-8")
  raise ValueError("Not supported: %s" % str_bytes_or_unicode)