def _wrap(begin, text, parts, end, tail):
    """Wrap some iterable parts in beginning and ending fenceposts. Simply
    yields begin, then each part, then end."""
    if begin:
        yield begin
    if text:
        yield text
    for part in parts:
        yield part
    if end:
        yield end
    if tail:
        yield tail
