<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_default_gateway(self, ip=4):
 """ Returns the default gateway for given IP version. The ``ip`` argument is used to specify the IP version, and can be either 4 or 6. """

        net_type = netifaces.AF_INET if ip == 4 else netifaces.AF_INET6
        gw = netifaces.gateways()['default'].get(net_type, (None, None))
        if gw[1] == self.name:
            return gw[0]