<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def CheckForeignKeysWrapper(conn):
 """Migration wrapper that checks foreign keys. Note that this may raise different exceptions depending on the underlying database API. """

    yield
    cur = conn.cursor()
    cur.execute('PRAGMA foreign_key_check')
    errors = cur.fetchall()
    if errors:
        raise ForeignKeyError(errors)