def _communicate_with_igd(port=15441, desc='UpnpPunch', retries=3, fn=_create_open_message, protos=('TCP', 'UDP')):
 local_ips = (_get_local_ips() * retries)
 success = False
 for local_ip in local_ips:
  try:
   _orchestrate_soap_request(local_ip, port, fn, desc, protos)
   success = True
   break
  except (UpnpError, IGDError) as e:
   logging.debug('Upnp request using "{0}" failed: {1}'.format(local_ip, e))
   success = False
   continue
 if (not success):
  raise UpnpError('Failed to communicate with igd using port {0} on local machine after {1} tries.'.format(port, retries))

def _communicate_with_igd ( port = 15441 , desc = 'UpnpPunch' , retries = 3 , fn = _create_open_message , protos = ( 'TCP' , 'UDP' ) ) : local_ips = ( _get_local_ips ( ) * retries ) success = False for local_ip in local_ips : try : _orchestrate_soap_request ( local_ip , port , fn , desc , protos ) success = True break except ( UpnpError , IGDError ) as e : logging . debug ( 'Upnp request using "{0}" failed: {1}' . format ( local_ip , e ) ) success = False continue if ( not success ) : raise UpnpError ( 'Failed to communicate with igd using port {0} on local machine after {1} tries.' . format ( port , retries ) )
manage sending a message generated by fn .