def do_user_implementation(func):
    if isinstance(func, Function):
        function = func
    else:
        function = Function(func)
    if discard_units:
        if (not ((target == 'numpy') and (code is None))):
            raise TypeError("'discard_units' can only be set for code generation target 'numpy', without providing any code.")
        function.implementations.add_numpy_implementation(wrapped_func=func, dependencies=dependencies, discard_units=discard_units, compiler_kwds=compiler_kwds)
    else:
        function.implementations.add_implementation(target, code=code, dependencies=dependencies, namespace=namespace, name=name, compiler_kwds=compiler_kwds)
    return function
def do_user_implementation(func):
    if isinstance(func, Function):
        function = func
    else:
        function = Function(func)
    if discard_units:
        if (not ((target == 'numpy') and (code is None))):
            raise TypeError("'discard_units' can only be set for code generation target 'numpy', without providing any code.")
        function.implementations.add_numpy_implementation(wrapped_func=func, dependencies=dependencies, discard_units=discard_units, compiler_kwds=compiler_kwds)
    else:
        function.implementations.add_implementation(target, code=code, dependencies=dependencies, namespace=namespace, name=name, compiler_kwds=compiler_kwds)
    return function