import pymysql def connect_db(creds): connection = pymysql.connect(host=creds['host'], user=creds['user'], password=creds['password'], db=creds['db']) return connection.cursor()