def _create_open_message(local_ip, port, description='UPnPPunch', protocol='TCP', upnp_schema='WANIPConnection'):
 soap_message = '<?xml version="1.0"?>\n<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">\n    <s:Body>\n        <u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:{upnp_schema}:1">\n            <NewRemoteHost></NewRemoteHost>\n            <NewExternalPort>{port}</NewExternalPort>\n            <NewProtocol>{protocol}</NewProtocol>\n            <NewInternalPort>{port}</NewInternalPort>\n            <NewInternalClient>{host_ip}</NewInternalClient>\n            <NewEnabled>1</NewEnabled>\n            <NewPortMappingDescription>{description}</NewPortMappingDescription>\n            <NewLeaseDuration>0</NewLeaseDuration>\n        </u:AddPortMapping>\n    </s:Body>\n</s:Envelope>'.format(port=port, protocol=protocol, host_ip=local_ip, description=description, upnp_schema=upnp_schema)
 return (REMOVE_WHITESPACE.sub('><', soap_message), 'AddPortMapping')

def _create_open_message ( local_ip , port , description = 'UPnPPunch' , protocol = 'TCP' , upnp_schema = 'WANIPConnection' ) : soap_message = '<?xml version="1.0"?>\n<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">\n    <s:Body>\n        <u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:{upnp_schema}:1">\n            <NewRemoteHost></NewRemoteHost>\n            <NewExternalPort>{port}</NewExternalPort>\n            <NewProtocol>{protocol}</NewProtocol>\n            <NewInternalPort>{port}</NewInternalPort>\n            <NewInternalClient>{host_ip}</NewInternalClient>\n            <NewEnabled>1</NewEnabled>\n            <NewPortMappingDescription>{description}</NewPortMappingDescription>\n            <NewLeaseDuration>0</NewLeaseDuration>\n        </u:AddPortMapping>\n    </s:Body>\n</s:Envelope>' . format ( port = port , protocol = protocol , host_ip = local_ip , description = description , upnp_schema = upnp_schema ) return ( REMOVE_WHITESPACE . sub ( '><' , soap_message ) , 'AddPortMapping' )
build a soap addportmapping message .