def copyfunc(f, name=None):
    """Returns a deepcopy of a function."""
    try:
        return types.FunctionType(f.func_code, f.func_globals, name or f.name,
                                  f.func_defaults, f.func_closure)
    except __HOLE__:
        return types.FunctionType(f.__code__, f.__globals__, name or f.name,
                                  f.__defaults__, f.__closure__)
dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/isomorphism/matchhelpers.py/copyfunc