'Looks up the mime type and error_code for \'filename\'.
Uses the error handlers in \'config\' to determine if the file should
be treated as an error blob.
Args:
config: The app.yaml object to check the filename against.
filename: The name of the file.
Returns:
A tuple of (mime_type, error_code), or (None, None) if this is not an
error blob.  For example, (\'text/plain\', default) or (\'image/gif\',
timeout) or (None, None).'

def __LookupErrorBlob(self, config, filename):

    if (not config.error_handlers):
        return (None, None)
    for error_handler in config.error_handlers:
        if (error_handler.file == filename):
            error_code = error_handler.error_code
            error_code = (error_code or 'default')
            if error_handler.mime_type:
                return (error_handler.mime_type, error_code)
            else:
                return (self.__MimeType(filename), error_code)
    return (None, None)
