def _buildItem(self, elem, cls=None, initpath=None):
<EOL>initpath = initpath or self._initpath<EOL>if cls is not None:<EOL><INDENT>return cls(self._server, elem, initpath)<EOL><DEDENT>etype = elem.attrib.get('<STR_LIT:type>', elem.attrib.get('<STR_LIT>'))<EOL>ehash = '<STR_LIT>' % (elem.tag, etype) if etype else elem.tag<EOL>ecls = utils.PLEXOBJECTS.get(ehash, utils.PLEXOBJECTS.get(elem.tag))<EOL>if ecls is not None:<EOL><INDENT>return ecls(self._server, elem, initpath)<EOL><DEDENT>raise UnknownType("<STR_LIT>" % (elem.tag, etype))<EOL>
Factory function to build objects based on registered PLEXOBJECTS.