'Assert that a root element, when flattened, is equal to a string, and
performs no asynchronus Deferred anything.
This version is more convenient in tests which wish to make multiple
assertions about flattening, since it can be called multiple times
without having to add multiple callbacks.
@return: the result of rendering L{root}, which should be equivalent to
L{target}.
@rtype: L{bytes}'

def assertFlattensImmediately(self, root, target):

    results = []
    it = self.assertFlattensTo(root, target)
    it.addBoth(results.append)
    self.addCleanup(it.cancel)
    if (not results):
        self.fail('Rendering    did    not    complete    immediately.')
    result = results[0]
    if isinstance(result, Failure):
        result.raiseException()
    return results[0]
