import socket


def get_src(dest):
    """
    Attempts to learn the source IP from the outbound interface used to reach the provided
    destination
    :param dest: destination address/ip
    :return: local ip
    """
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
    s.connect((dest, 1))
    source_ip = s.getsockname()[0]
    s.close()
    return source_ip