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

def _preprocess_attributes(attributes):
    '''
    Pre-process incoming queue attributes before setting them
    '''
    if isinstance(attributes, six.string_types):
        attributes = salt.utils.json.loads(attributes)

    def stringified(val):
        # Some attributes take full json policy documents, but they take them
        # as json strings. Convert the value back into a json string.
        if isinstance(val, dict):
            return salt.utils.json.dumps(val)
        return val

    return dict(
        (attr, stringified(val)) for attr, val in six.iteritems(attributes)
    )