<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect(db, host=HACR_DATABASE_SERVER, user=HACR_DATABASE_USER, passwd=HACR_DATABASE_PASSWD):
 """Connect to the given SQL database """

    try:
        import pymysql
    except ImportError as e:
        e.args = ('pymysql is required to fetch HACR triggers',)
        raise
    return pymysql.connect(host=host, user=user, passwd=passwd, db=db)