import imaplib


def open_session(imap_url, username, password):
    """Function creates and returns an object of the connection with specified credentials and imap_url"""
    con = imaplib.IMAP4_SSL(imap_url)
    con.login(username, password)
    return con