code: def _findSubnetMask(self, ip):
          
          ip = ip
  
          if "win32" in sys.platform:
              try:
                  proc = subprocess.Popen("ipconfig", stdout=subprocess.PIPE)
                  while True:
                      line = proc.stdout.readline()
                      if ip.encode() in line:
                          break
                  mask = (
                      proc.stdout.readline()
                      .rstrip()
                      .split(b":")[-1]
                      .replace(b" ", b"")
                      .decode()
                  )
              except:
                  raise NetworkInterfaceException("Cannot read IP parameters from OS")
          else:
              """
              This procedure could use more direct way of obtaining the broadcast IP
              as it is really simple in Unix
              ifconfig gives Bcast directly for example
              or use something like :
              iface = "eth0"
              socket.inet_ntoa(fcntl.ioctl(socket.socket(socket.AF_INET, socket.SOCK_DGRAM), 35099, struct.pack('256s', iface))[20:24])
              """
              pattern = re.compile(r"(255.\d{1,3}.\d{1,3}.\d{1,3})")
  
              try:
                  proc = subprocess.Popen("ifconfig", stdout=subprocess.PIPE)
                  while True:
                      line = proc.stdout.readline()
                      if ip.encode() in line:
                          break
                  mask = re.findall(pattern, line.decode())[0]
              except:
                  mask = "255.255.255.255"
          # self._log.debug('Mask found : %s' %  mask)
          return mask
docs: Retrieve the broadcast IP address connected to internet... used as
          a default IP address when defining Script
  
          :param ip: (str) optionnal IP address. If not provided, default to getIPAddr()
          :param mask: (str) optionnal subnet mask. If not provided, will try to find one using ipconfig (Windows) or ifconfig (Linux or MAC)
  
          :returns: broadcast IP Adress as String