def to_unicode(value):
  """Returns a unicode string from a string, using UTF-8 to decode if needed.

  This function comes from `Tornado`_.

  :param value:
    A unicode or string to be decoded.
  :returns:
    The decoded string.
  """
  if isinstance(value, str):
    return value.decode('utf-8')

  assert isinstance(value, unicode)
  return value
def to_unicode ( value ) : if isinstance ( value , str ) : return value . decode ( 'utf-8' ) assert isinstance ( value , unicode ) return value
Returns a unicode string from a string, using UTF-8 to decode if needed.

  This function comes from `Tornado`_.

  :param value:
    A unicode or string to be decoded.
  :returns:
    The decoded string.