Weave advices on target with input pointcut.

    :param callable target: target from where checking pointcut and
        weaving advices.
    :param advices: advices to weave on target.
    :param ctx: target ctx (class or instance).
    :param pointcut: condition for weaving advices on joinpointe.
        The condition depends on its type.
    :type pointcut:
        - NoneType: advices are weaved on target.
        - str: target name is compared to pointcut regex.
        - function: called with target in parameter, if True, advices will
            be weaved on target.
    :param int depth: class weaving depthing.
    :param bool public: (default True) weave only on public members.
    :param routine pointcut_application: routine which applies a pointcut when
        required. _Joinpoint().apply_pointcut by default. Such routine has
        to take in parameters a routine called target and its related
        function called function. Its result is the interception function.
    :param float ttl: time to leave for weaved advices.

    :return: the intercepted functions created from input target or a tuple
        with intercepted functions and ttl timer.
    :rtype: list

    :raises: AdviceError if pointcut is not None, not callable neither a str.

def weave(
        target, advices, pointcut=None, ctx=None, depth=1, public=False,
        pointcut_application=None, ttl=None
):
    """Weave advices on target with input pointcut.

    :param callable target: target from where checking pointcut and
        weaving advices.
    :param advices: advices to weave on target.
    :param ctx: target ctx (class or instance).
    :param pointcut: condition for weaving advices on joinpointe.
        The condition depends on its type.
    :type pointcut:
        - NoneType: advices are weaved on target.
        - str: target name is compared to pointcut regex.
        - function: called with target in parameter, if True, advices will
            be weaved on target.
    :param int depth: class weaving depthing.
    :param bool public: (default True) weave only on public members.
    :param routine pointcut_application: routine which applies a pointcut when
        required. _Joinpoint().apply_pointcut by default. Such routine has
        to take in parameters a routine called target and its related
        function called function. Its result is the interception function.
    :param float ttl: time to leave for weaved advices.

    :return: the intercepted functions created from input target or a tuple
        with intercepted functions and ttl timer.
    :rtype: list

    :raises: AdviceError if pointcut is not None, not callable neither a str.
    """

    result = []

    # initialize advices
    if isroutine(advices):
        advices = [advices]

    if advices:
        # initialize pointcut
        # do nothing if pointcut is None or is callable
        if pointcut is None or callable(pointcut):
            pass
        # in case of str, use a name matcher
        elif isinstance(pointcut, string_types):
            pointcut = _namematcher(pointcut)
        else:
            error_msg = "Wrong pointcut to check weaving on {0}."
            error_msg = error_msg.format(target)
            advice_msg = "Must be None, or be a str or a function/method."
            right_msg = "Not {0}".format(type(pointcut))

            raise AdviceError(
                "{0} {1} {2}".format(error_msg, advice_msg, right_msg)
            )

        if ctx is None:
            ctx = find_ctx(elt=target)

        _weave(
            target=target, advices=advices, pointcut=pointcut, depth=depth,
            depth_predicate=_publiccallable if public else callable, ctx=ctx,
            intercepted=result, pointcut_application=pointcut_application
        )

        if ttl is not None:
            kwargs = {
                'target': target,
                'advices': advices,
                'pointcut': pointcut,
                'depth': depth,
                'public': public,
                'ctx': ctx
            }
            timer = Timer(ttl, unweave, kwargs=kwargs)
            timer.start()

            result = result, timer

    return result