def _get_ip(self, interface):
        """
        Returns the interface's IPv4 address if device exists and has a valid
        ip address. Otherwise, returns an empty string
        """
        if interface in ni.interfaces():
            addresses = ni.ifaddresses(interface)
            if ni.AF_INET in addresses:
                return addresses[ni.AF_INET][0]["addr"]
        return ""
def _get_ip ( self , interface ) : if interface in ni . interfaces ( ) : addresses = ni . ifaddresses ( interface ) if ni . AF_INET in addresses : return addresses [ ni . AF_INET ] [ 0 ] [ "addr" ] return ""
Returns the interface's IPv4 address if device exists and has a valid
        ip address. Otherwise, returns an empty string