def implemented_function(symfunc, implementation):
    """Add numerical ``implementation`` to function ``symfunc``.

    ``symfunc`` can be an ``UndefinedFunction`` instance, or a name string.
    In the latter case we create an ``UndefinedFunction`` instance with that
    name.

    Be aware that this is a quick workaround, not a general method to create
    special symbolic functions. If you want to create a symbolic function to be
    used by all the machinery of Diofant you should subclass the ``Function``
    class.

    Parameters
    ==========

    symfunc : ``str`` or ``UndefinedFunction`` instance
       If ``str``, then create new ``UndefinedFunction`` with this as
       name.  If `symfunc` is a diofant function, attach implementation to it.
    implementation : callable
       numerical implementation to be called by ``evalf()`` or ``lambdify``

    Returns
    =======

    afunc : diofant.FunctionClass instance
       function with attached implementation

    Examples
    ========

    >>> f = implemented_function(Function('f'), lambda x: x+1)
    >>> lam_f = lambdify(x, f(x))
    >>> lam_f(4)
    5

    """
    from ..core.function import UndefinedFunction
    if isinstance(symfunc, str):
        symfunc = UndefinedFunction(symfunc)
    elif not isinstance(symfunc, UndefinedFunction):
        raise ValueError(
            'symfunc should be either a string or an UndefinedFunction instance.'
            )
    symfunc._imp_ = staticmethod(implementation)
    return symfunc
