def read_block(fi):
    """Read and returns one block of non-empty lines from an input stream (stripped lines are returned in a list)"""
    block = []
    for line in fi:
        line = line.strip()
        if not line and len(block):
            break
        block.append(line)
    return block