from_code(code, co_argcount=BORROW, co_kwonlyargcount=BORROW, co_nlocals=BORROW, co_stacksize=BORROW, co_flags=BORROW, co_code=BORROW, co_consts=BORROW, co_names=BORROW, co_varnames=BORROW, co_filename=BORROW, co_name=BORROW, co_firstlineno=BORROW, co_lnotab=BORROW, co_freevars=BORROW, co_cellvars=BORROW)

        Create a new instance from an existing code object. The originating
        internals of the instance will be that of the running python version.

        Any properties explicitly specified will be overridden on the new
        instance.

        Arguments:
            code(types.CodeType): The code object to get the properties of.
            ...: The properties to override.

        Returns:
            CodeObject: A new :class:`CodeObject` instance.

def from_code(cls, code, co_argcount=BORROW, co_kwonlyargcount=BORROW, co_nlocals=BORROW, co_stacksize=BORROW,
                  co_flags=BORROW, co_code=BORROW, co_consts=BORROW, co_names=BORROW, co_varnames=BORROW,
                  co_filename=BORROW, co_name=BORROW, co_firstlineno=BORROW, co_lnotab=BORROW, co_freevars=BORROW,
                  co_cellvars=BORROW):
        """from_code(code, co_argcount=BORROW, co_kwonlyargcount=BORROW, co_nlocals=BORROW, co_stacksize=BORROW, co_flags=BORROW, co_code=BORROW, co_consts=BORROW, co_names=BORROW, co_varnames=BORROW, co_filename=BORROW, co_name=BORROW, co_firstlineno=BORROW, co_lnotab=BORROW, co_freevars=BORROW, co_cellvars=BORROW)

        Create a new instance from an existing code object. The originating
        internals of the instance will be that of the running python version.

        Any properties explicitly specified will be overridden on the new
        instance.

        Arguments:
            code(types.CodeType): The code object to get the properties of.
            ...: The properties to override.

        Returns:
            CodeObject: A new :class:`CodeObject` instance.
        """

        if six.PY2:
            co_kwonlyargcount = co_kwonlyargcount if co_kwonlyargcount is not BORROW else 0
        else:
            co_kwonlyargcount = co_kwonlyargcount if co_kwonlyargcount is not BORROW else code.co_kwonlyargcount

        return cls(
            co_argcount if co_argcount is not BORROW else code.co_argcount,
            co_kwonlyargcount,
            co_nlocals if co_nlocals is not BORROW else code.co_nlocals,
            co_stacksize if co_stacksize is not BORROW else code.co_stacksize,
            co_flags if co_flags is not BORROW else code.co_flags,
            co_code if co_code is not BORROW else code.co_code,
            co_consts if co_consts is not BORROW else code.co_consts,
            co_names if co_names is not BORROW else code.co_names,
            co_varnames if co_varnames is not BORROW else code.co_varnames,
            co_filename if co_filename is not BORROW else code.co_filename,
            co_name if co_name is not BORROW else code.co_name,
            co_firstlineno if co_firstlineno is not BORROW else code.co_firstlineno,
            co_lnotab if co_lnotab is not BORROW else code.co_lnotab,
            co_freevars if co_freevars is not BORROW else code.co_freevars,
            co_cellvars if co_cellvars is not BORROW else code.co_cellvars,
        )