<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def retry_mkstemp(suffix='', prefix='tmp', directory=None, max_retries=3):
 """ Make mkstemp more robust against AFS glitches. """

    if directory is None:
        directory = current_app.config['CFG_TMPSHAREDDIR']
    for retry_count in range(1, max_retries + 1):
        try:
            tmp_file_fd, tmp_file_name = tempfile.mkstemp(suffix=suffix,
                                                          prefix=prefix,
                                                          dir=directory)
        except OSError as e:
            if e.errno == 19 and retry_count <= max_retries:
                # AFS Glitch?
                time.sleep(10)
            else:
                raise
        else:
            break
    return tmp_file_fd, tmp_file_name