def get_default_gw():
octet_list = []<EOL>gw_from_route = None<EOL>f = open ('<STR_LIT>', '<STR_LIT:r>')<EOL>for line in f:<EOL><INDENT>words = line.split()<EOL>dest = words[<NUM_LIT:1>]<EOL>try:<EOL><INDENT>if (int (dest) == <NUM_LIT:0>):<EOL><INDENT>gw_from_route = words[<NUM_LIT:2>]<EOL>break<EOL><DEDENT><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if not gw_from_route:<EOL><INDENT>return None <EOL><DEDENT>for i in range(<NUM_LIT:8>, <NUM_LIT:1>, -<NUM_LIT:2>):<EOL><INDENT>octet = gw_from_route[i-<NUM_LIT:2>:i]<EOL>octet = int(octet, <NUM_LIT:16>)<EOL>octet_list.append(str(octet)) <EOL><DEDENT>gw_ip = "<STR_LIT:.>".join(octet_list)<EOL>return gw_ip<EOL>
Returns the default gateway