import ssl


def get_sslcontext(use_https, tls_ver=1.1):
    """Create an SSLContext object to use for the connections."""
    if not use_https:
        return None
    if tls_ver == 1.1:
        return ssl.SSLContext(ssl.PROTOCOL_TLSv1_1)
    elif tls_ver == 1.2:
        return ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)