def _process_content(content, encoding):
    """Decode the content taking into consideration the encoding."""
    result = content
    if six.PY3 and not isinstance(result, six.binary_type):
        # At this point, content will be string, which is wrong for Python 3.
        result = result.encode()

    steps = _decode_steps(encoding)
    if not steps:
        LOG.error("Unknown encoding, doing nothing.")
        return result

    for mime_type in _decode_steps(encoding):
        if mime_type == GZIP_MIME:
            bufferio = io.BytesIO(result)
            with gzip.GzipFile(fileobj=bufferio, mode='rb') as file_handle:
                try:
                    result = file_handle.read()
                except (IOError, ValueError):
                    LOG.exception("Fail to decompress gzip content.")
        elif mime_type == BASE64_MIME:
            try:
                result = base64.b64decode(result)
            except (ValueError, __HOLE__):
                LOG.exception("Fail to decode base64 content.")
    return result
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/plugins/common/userdataplugins/cloudconfigplugins/write_files.py/_process_content