<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _makeNestedTempDir(top, seed, levels=2):
 """ Gets a temporary directory in the hierarchy of directories under a given top directory. This exists to avoid placing too many temporary directories under a single top in a flat structure, which can slow down metadata updates such as deletes on the local file system. The seed parameter allows for deterministic placement of the created directory. The seed is hashed into hex digest and the directory structure is created from the initial letters of the digest. :param top : string, top directory for the hierarchy :param seed : string, the hierarchy will be generated from this seed string :rtype : string, path to temporary directory - will be created when necessary. """

    # Valid chars for the creation of temporary directories
    validDirs = hashlib.md5(six.b(str(seed))).hexdigest()
    tempDir = top
    for i in range(max(min(levels, len(validDirs)), 1)):
        tempDir = os.path.join(tempDir, validDirs[i])
        if not os.path.exists(tempDir):
            try:
                os.makedirs(tempDir)
            except os.error:
                if not os.path.exists(tempDir):
                    # In the case that a collision occurs and
                    # it is created while we wait then we ignore
                    raise
    return tempDir