code: def update(self):
          
          # Init new stats
          stats = self.get_init_value()
  
          if self.input_method == 'local' and not import_error_tag:
              # Update stats using the netifaces lib
              try:
                  default_gw = netifaces.gateways()['default'][netifaces.AF_INET]
              except (KeyError, AttributeError) as e:
                  logger.debug("Cannot grab the default gateway ({})".format(e))
              else:
                  try:
                      stats['address'] = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['addr']
                      stats['mask'] = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['netmask']
                      stats['mask_cidr'] = self.ip_to_cidr(stats['mask'])
                      stats['gateway'] = netifaces.gateways()['default'][netifaces.AF_INET][0]
                      stats['public_address'] = self.public_address
                  except (KeyError, AttributeError) as e:
                      logger.debug("Cannot grab IP information: {}".format(e))
          elif self.input_method == 'snmp':
              # Not implemented yet
              pass
  
          # Update the stats
          self.stats = stats
  
          return self.stats
docs: Update IP stats using the input method.
  
          Stats is dict