Convert the code object co into a python source fragment.

    :param version:         The python version this code is from as a float, for
                            example 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 etc.
    :param co:              The code object to parse.
    :param out:             File like object to write the output to.
    :param debug_opts:      A dictionary with keys
       'asm':     value determines whether to show
                  mangled bytecode disdassembly
       'ast':     value determines whether to show
       'grammar': boolean determining whether to show
                  grammar reduction rules.
       If value is a file-like object, output that object's write method will
       be used rather than sys.stdout

    :return: The deparsed source fragment.

def code_deparse(co, out=StringIO(), version=None, is_pypy=None,
                 debug_opts=DEFAULT_DEBUG_OPTS,
                 code_objects={}, compile_mode='exec',
                 walker=FragmentsWalker):
    """
    Convert the code object co into a python source fragment.

    :param version:         The python version this code is from as a float, for
                            example 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 etc.
    :param co:              The code object to parse.
    :param out:             File like object to write the output to.
    :param debug_opts:      A dictionary with keys
       'asm':     value determines whether to show
                  mangled bytecode disdassembly
       'ast':     value determines whether to show
       'grammar': boolean determining whether to show
                  grammar reduction rules.
       If value is a file-like object, output that object's write method will
       be used rather than sys.stdout

    :return: The deparsed source fragment.
    """

    assert iscode(co)

    if version is None:
        version = sysinfo2float()
    if is_pypy is None:
        is_pypy = IS_PYPY

    scanner = get_scanner(version, is_pypy=is_pypy)

    show_asm = debug_opts.get('asm', None)
    tokens, customize = scanner.ingest(co, code_objects=code_objects,
                                       show_asm=show_asm)

    tokens, customize = scanner.ingest(co)
    maybe_show_asm(show_asm, tokens)

    debug_parser = dict(PARSER_DEFAULT_DEBUG)
    show_grammar = debug_opts.get('grammar', None)
    if show_grammar:
        debug_parser['reduce'] = show_grammar
        debug_parser['errorstack'] = True

    # Build Syntax Tree from tokenized and massaged disassembly.
    # deparsed = pysource.FragmentsWalker(out, scanner, showast=showast)
    show_ast = debug_opts.get('ast', None)
    deparsed = walker(version, scanner, showast=show_ast,
                      debug_parser=debug_parser, compile_mode=compile_mode,
                      is_pypy=is_pypy)

    deparsed.ast = deparsed.build_ast(tokens, customize)

    assert deparsed.ast == 'stmts', 'Should have parsed grammar start'

    del tokens # save memory

    # convert leading '__doc__ = "..." into doc string
    assert deparsed.ast == 'stmts'
    (deparsed.mod_globs,
     nonlocals) = (pysource
                   .find_globals_and_nonlocals(deparsed.ast,
                                               set(), set(),
                                               co, version))

    # Just when you think we've forgotten about what we
    # were supposed to to: Generate source from the Syntax ree!
    deparsed.gen_source(deparsed.ast, co.co_name, customize)

    deparsed.set_pos_info(deparsed.ast, 0, len(deparsed.text))
    deparsed.fixup_parents(deparsed.ast, None)

    for g in sorted(deparsed.mod_globs):
        deparsed.write('# global %s ## Warning: Unused global\n' % g)

    if deparsed.ast_errors:
        deparsed.write("# NOTE: have decompilation errors.\n")
        deparsed.write("# Use -t option to show full context.")
        for err in deparsed.ast_errors:
            deparsed.write(err)
        deparsed.ERROR = True

    if deparsed.ERROR:
        raise deparsed.ERROR

    # To keep the API consistent with previous releases, convert
    # deparse.offset values into NodeInfo items
    for tup, node in deparsed.offsets.items():
        deparsed.offsets[tup] = NodeInfo(node = node, start = node.start,
                                         finish = node.finish)

    deparsed.scanner = scanner
    return deparsed