def _make_content_item(node, mime_type=None, alternate_data=None):
raw = node.data<EOL>if getattr(node, '<STR_LIT>', None) == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>raw = zlib.decompress(node.data)<EOL><DEDENT>except Exception as exc:<EOL><INDENT>if alternate_data is not None:<EOL><INDENT>try:<EOL><INDENT>raw = zlib.decompress(alternate_data)<EOL><DEDENT>except Exception:<EOL><INDENT>raise exc  <EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if mime_type is None:<EOL><INDENT>mime_type = node.mime_type<EOL><DEDENT>raw = raw.decode('<STR_LIT:utf8>').encode('<STR_LIT:utf8>')<EOL>return streamcorpus.ContentItem(raw=raw, media_type=mime_type)<EOL>
Create a ContentItem from a node in the spinn3r data tree.

    The ContentItem is created with raw data set to ``node.data``,
    decompressed if the node's encoding is 'zlib', and UTF-8
    normalized, with a MIME type from ``node.mime_type``.

    ``node``
      the actual node from the spinn3r protobuf data
    ``mime_type``
      string MIME type to use (defaults to ``node.mime_type``)
    ``alternate_data``
      alternate (compressed) data to use, if ``node.data`` is missing
      or can't be decompressed