'Returns a oracle connection object
Optional parameters for using a custom DSN connection (instead of using a server alias from tnsnames.ora)
The dsn (data source name) is the TNS entry (from the Oracle names server or tnsnames.ora file)
or is a string like the one returned from makedsn().
:param dsn: the host address for the Oracle server
:param service_name: the db_unique_name of the database that you are connecting to (CONNECT_DATA part of TNS)
You can set these parameters in the extra fields of your connection
as in ``{ "dsn":"some.host.address" , "service_name":"some.service.name" }``'

def get_conn(self):

    conn = self.get_connection(self.oracle_conn_id)
    dsn = conn.extra_dejson.get('dsn', None)
    sid = conn.extra_dejson.get('sid', None)
    mod = conn.extra_dejson.get('module', None)
    service_name = conn.extra_dejson.get('service_name', None)
    if (dsn and sid and (not service_name)):
        dsn = cx_Oracle.makedsn(dsn, conn.port, sid)
        conn = cx_Oracle.connect(conn.login, conn.password, dsn=dsn)
    elif (dsn and service_name and (not sid)):
        dsn = cx_Oracle.makedsn(dsn, conn.port, service_name=service_name)
        conn = cx_Oracle.connect(conn.login, conn.password, dsn=dsn)
    else:
        conn = cx_Oracle.connect(conn.login, conn.password, conn.host)
    if (mod is not None):
        conn.module = mod
    return conn
