import netifaces


def get_interface():
    return netifaces.gateways()['default'][netifaces.AF_INET][1]

import netifaces


def get_interface():
    return netifaces.gateways()['default'][netifaces.AF_INET][1]


def get_local_IP():
    def_gw_device = get_interface()
    return netifaces.ifaddresses(def_gw_device)[netifaces.AF_INET][0]['addr']

Add function to get the machine's local IP
Add function to get the machine's local IP

  import netifaces
  
  
  def get_interface():
      return netifaces.gateways()['default'][netifaces.AF_INET][1]
  
+ 
+ def get_local_IP():
+     def_gw_device = get_interface()
+     return netifaces.ifaddresses(def_gw_device)[netifaces.AF_INET][0]['addr']
+ 
Add function to get the machine's local IP
## Code Before:
import netifaces


def get_interface():
    return netifaces.gateways()['default'][netifaces.AF_INET][1]

## Instruction:
Add function to get the machine's local IP
## Code After:
import netifaces


def get_interface():
    return netifaces.gateways()['default'][netifaces.AF_INET][1]


def get_local_IP():
    def_gw_device = get_interface()
    return netifaces.ifaddresses(def_gw_device)[netifaces.AF_INET][0]['addr']
