def create_cn(hostname, password, username, dbname):
 if password:
  cn = connect(host=hostname, user=username, database=dbname, password=password)
 else:
  cn = connect(user=username, database=dbname)
 print(u'Created connection: {0}.'.format(cn.dsn))
 return cn

def create_cn ( hostname , password , username , dbname ) : if password : cn = connect ( host = hostname , user = username , database = dbname , password = password ) else : cn = connect ( user = username , database = dbname ) print ( u'Created connection: {0}.' . format ( cn . dsn ) ) return cn
open connection to database .