import six


def encode_string(value):
    """ Encode unicode to string: unicode -> str, str -> str
    Arguments:
        value (str/unicode): string to encode
    Returns:
        encoded value (string)
    """
    return value.encode('utf-8') if isinstance(value, six.text_type) else value