<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _convert_key_to_str(key):
    '''
    Stolen completely from boto.providers
    '''
    # IMPORTANT: on PY2, the secret key must be str and not unicode to work
    # properly with hmac.new (see http://bugs.python.org/issue5285)
    #
    # pylint: disable=incompatible-py3-code,undefined-variable
    return salt.utils.data.encode(key) \
        if six.PY2 and isinstance(key, unicode) \
        else key