def get_device_address(device):
if device is None:<EOL><INDENT>return None<EOL><DEDENT>command = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT:list>', '<STR_LIT>', device]<EOL>ip_routes = subprocess.check_output(command).strip()<EOL>for line in ip_routes.split('<STR_LIT:\n>'):<EOL><INDENT>seen = '<STR_LIT>'<EOL>for a in line.split():<EOL><INDENT>if seen == '<STR_LIT:src>':<EOL><INDENT>return a<EOL><DEDENT>seen = a<EOL><DEDENT><DEDENT>return None<EOL>
find the local ip address on the given device