code: def get_lan_ip(interface="default"):
      if sys.version_info < (3, 0, 0):
          if type(interface) == str:
              interface = unicode(interface)
      else:
          if type(interface) == bytes:
              interface = interface.decode("utf-8")
  
      # Get ID of interface that handles WAN stuff.
      default_gateway = get_default_gateway(interface)
      gateways = netifaces.gateways()
      wan_id = None
      if netifaces.AF_INET in gateways:
          gw_list = gateways[netifaces.AF_INET]
          for gw_info in gw_list:
              if gw_info[0] == default_gateway:
                  wan_id = gw_info[1]
                  break
  
      # Find LAN IP of interface for WAN stuff.
      interfaces = netifaces.interfaces()
      if wan_id in interfaces:
          families = netifaces.ifaddresses(wan_id)
          if netifaces.AF_INET in families:
              if_info_list = families[netifaces.AF_INET]
              for if_info in if_info_list:
                  if "addr" in if_info:
                      return if_info["addr"]
  
      
      if platform.system() == "Linux":
          if ip is not None:
              return ip.routes["8.8.8.8"]["prefsrc"]
  
      return None
docs: Execution may reach here if the host is using
      virtual interfaces on Linux and there are no gateways
      which suggests the host is a VPS or server. In this
      case