<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def copy_block(block=None, update_working_block=True):
 """ Makes a copy of an existing block :param block: The block to clone. (defaults to the working block) :return: The resulting block """

    block_in = working_block(block)
    block_out, temp_wv_map = _clone_block_and_wires(block_in)
    mems = {}
    for net in block_in.logic:
        _copy_net(block_out, net, temp_wv_map, mems)
    block_out.mem_map = mems

    if update_working_block:
        set_working_block(block_out)
    return block_out