def _extend_blocks(result, blocks=None):
from pandas.core.internals import BlockManager<EOL>if blocks is None:<EOL><INDENT>blocks = []<EOL><DEDENT>if isinstance(result, list):<EOL><INDENT>for r in result:<EOL><INDENT>if isinstance(r, list):<EOL><INDENT>blocks.extend(r)<EOL><DEDENT>else:<EOL><INDENT>blocks.append(r)<EOL><DEDENT><DEDENT><DEDENT>elif isinstance(result, BlockManager):<EOL><INDENT>blocks.extend(result.blocks)<EOL><DEDENT>else:<EOL><INDENT>blocks.append(result)<EOL><DEDENT>return blocks<EOL>
return a new extended blocks, givin the result