<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def force_encoding(value, encoding='utf-8'):
 """ Return a string encoded in the provided encoding """

    if not isinstance(value, (str, unicode)):
        value = str(value)
    if isinstance(value, unicode):
        value = value.encode(encoding)
    elif encoding != 'utf-8':
        value = value.decode('utf-8').encode(encoding)
    return value