def loadEntitlementFromString(xmlContent, *args, **kw):
    # handle old callers
    source=kw.get('source', '<override>')
    serverName = kw.get('serverName', None)
    if len(args):
        if len(args) == 1:
            source = args[0]
        elif len(args) == 2:
            serverName = args[0]
            source = args[1]
        else:
            raise TypeError(len(args) %'loadEntitlementFromString() takes exactly 1 argument (%d given)')

    if serverName:
        import warnings
        warnings.warn("The serverName argument to loadEntitlementFromString "
                      "has been deprecated", DeprecationWarning)

    returnTimeout = kw.pop('returnTimeout', False)

    p = EntitlementParser()

    # wrap this in an <entitlement> top level tag (making it optional
    # [but recommended!] in the entitlement itself)
    #
    # XXX This synthetic wrapping should probably be made obsolete; everyone
    # should use emitEntitlement, which does the right thing.
    try:
        if '<entitlement>' not in xmlContent:
            p.parse("<entitlement>" + xmlContent + "</entitlement>")
        else:
            p.parse(xmlContent)

        try:
            entClass = p.get('class', None)
            entKey = p['key']
        except KeyError:
            raise errors.ConaryError("Entitlement incomplete.  Entitlements"
                                     " must include 'server', 'class', and"
                                     " 'key' values")
    except Exception, err:
        raise errors.ConaryError("Malformed entitlement at %s:"
                                 " %s" % (source, err))


    if returnTimeout:
        return (p['server'], entClass, entKey, p['timeout'], p['retry'])

    return (p['server'], entClass, entKey)
dataset/ETHPy150Open sassoftware/conary/conary/conarycfg.py/loadEntitlementFromString/swapped operands of `%`