import requests


def get_tor_session(port=9050):
    """Get a "Session" instance to socks5 tor proxy.

    :param int port: the tor service port (default 9050)
    :return requests.Session: a requests Session like instance ready for tor network connection.
    """
    session = requests.session()
    # Tor uses the 9050 port as the default socks port
    session.proxies = {
        "http": "socks5://127.0.0.1:{:d}".format(port),
        "https": "socks5://127.0.0.1:{:d}".format(port)
    }
    return session