def char_encoding(value):
    """ Encode unicode into 'UTF-8' string.

    :param value:
    :return:
    """
    if not isinstance(value, bytes):
        return value.encode('utf-8')
    return value
