def METHOD_NAME(
    fn: Callable[[], T], retry_limit: int = 5, retry_wait: float = 0.2
) -> T:
    # Retry logic to recover from the case where two processes are creating
    # tables at the same time using sqlalchemy
    check.callable_param(fn, "fn")
    check.int_param(retry_limit, "retry_limit")
    check.numeric_param(retry_wait, "retry_wait")
    while True:
        try:
            return fn()
        except (
            mysql.ProgrammingError,
            mysql.IntegrityError,
            db_exc.ProgrammingError,
            db_exc.IntegrityError,
        ) as exc:
            if (
                isinstance(exc, db_exc.ProgrammingError)
                and exc.orig
                and exc.orig.errno == mysql_errorcode.ER_TABLE_EXISTS_ERROR
            ) or (
                isinstance(exc, mysql.ProgrammingError)
                and exc.errno == mysql_errorcode.ER_TABLE_EXISTS_ERROR
            ):
                raise
            logging.warning("Retrying failed database creation")
            if retry_limit == 0:
                raise DagsterMySQLException("too many retries for DB creation") from exc
        time.sleep(retry_wait)
        retry_limit -= 1