_imports = [] _parents = [] _version = 1 cEsc = "\x01" cEscSub = "\x02" cEscProxy = "#" cEscProxy2 = "##" cNL = "\n\r" mxpBegin = cEsc + "t+" mxpEnd = cEsc + "t-" mxpAmp = cEsc + "xa" def Esc(escString): #Escape Telnet IAC escString = escString.replace("\xFF", "\xFF\xFF") #Substitute # for escString = escString.replace(cEscProxy2, cEscSub) escString = escString.replace(cEscProxy, cEsc) return escString.replace(cEscSub, cEscProxy) def MXPTag(tagBody): return mxpBegin + tagBody + mxpEnd def MXPEntity(entityName): return mxpAmp + entityName + ";"