@staticmethod<EOL><INDENT>def __prepare_resource(data):<DEDENT>
if not data:<EOL><INDENT>return None<EOL><DEDENT>data = str(data)<EOL>try:<EOL><INDENT>resource = RESOURCEPREP.prepare(data)<EOL><DEDENT>except StringprepError as err:<EOL><INDENT>raise JIDError("<STR_LIT>".format(err))<EOL><DEDENT>if len(resource.encode("<STR_LIT:utf-8>")) > <NUM_LIT>:<EOL><INDENT>raise JIDError("<STR_LIT>")<EOL><DEDENT>return resource<EOL>
Prepare the resourcepart of the JID.

        :Parameters:
            - `data`: Resourcepart of the JID

        :raise JIDError: if the resource name is too long.
        :raise pyxmpp.xmppstringprep.StringprepError: if the
            resourcepart fails Resourceprep preparation.