Returns all input target annotations of cls type sorted
        by definition order.

        :param type cls: type of annotation to get from target.
        :param target: target from where get annotations.
        :param tuple/type exclude: annotation types to remove from selection.
        :param ctx: target ctx.
        :param select: bool function which select annotations after applying
            previous type filters. Takes a target, a ctx and an annotation in
            parameters. True by default.
        :param int mindepth: minimal depth for searching annotations (default 0)
        :param int maxdepth: maximal depth for searching annotations (default 0)
        :param bool followannotated: if True (default) follow deeply only
            annotated members.
        :param bool public: if True (default) follow public members.
        :param list _history: private parameter which save parsed elements.
        :rtype: Annotation

def get_annotations(
            cls, target,
            exclude=None, ctx=None, select=lambda *p: True,
            mindepth=0, maxdepth=0, followannotated=True, public=True,
            _history=None
    ):
        """Returns all input target annotations of cls type sorted
        by definition order.

        :param type cls: type of annotation to get from target.
        :param target: target from where get annotations.
        :param tuple/type exclude: annotation types to remove from selection.
        :param ctx: target ctx.
        :param select: bool function which select annotations after applying
            previous type filters. Takes a target, a ctx and an annotation in
            parameters. True by default.
        :param int mindepth: minimal depth for searching annotations (default 0)
        :param int maxdepth: maximal depth for searching annotations (default 0)
        :param bool followannotated: if True (default) follow deeply only
            annotated members.
        :param bool public: if True (default) follow public members.
        :param list _history: private parameter which save parsed elements.
        :rtype: Annotation
        """

        result = []

        if mindepth <= 0:

            try:
                annotations_by_ctx = get_property(
                    elt=target, key=Annotation.__ANNOTATIONS_KEY__, ctx=ctx
                )

            except TypeError:
                annotations_by_ctx = {}

            if not annotations_by_ctx:
                if ismethod(target):
                    func = get_method_function(target)
                    annotations_by_ctx = get_property(
                        elt=func,
                        key=Annotation.__ANNOTATIONS_KEY__,
                        ctx=ctx
                    )
                    if not annotations_by_ctx:
                        annotations_by_ctx = get_property(
                            elt=func, key=Annotation.__ANNOTATIONS_KEY__
                        )
                elif isfunction(target):
                    annotations_by_ctx = get_property(
                        elt=target,
                        key=Annotation.__ANNOTATIONS_KEY__
                    )

            exclude = () if exclude is None else exclude

            for elt, annotations in annotations_by_ctx:

                for annotation in annotations:

                    # check if annotation is a StopPropagation rule
                    if isinstance(annotation, StopPropagation):
                        exclude += annotation.annotation_types

                    # ensure propagation
                    if elt is not target and not annotation.propagate:
                        continue

                    # ensure overriding
                    if annotation.override:
                        exclude += (annotation.__class__, )

                    # check for annotation
                    if (isinstance(annotation, cls)
                            and not isinstance(annotation, exclude)
                            and select(target, ctx, annotation)):

                        result.append(annotation)

        if mindepth >= 0 or (maxdepth > 0 and (result or not followannotated)):

            if _history is None:
                _history = [target]

            else:
                _history.append(target)

            for name, member in getmembers(target):
                if (name[0] != '_' or not public) and member not in _history:

                    if ismethod(target) and name.startswith('im_'):
                        continue

                    result += cls.get_annotations(
                        target=member, exclude=exclude, ctx=ctx, select=select,
                        mindepth=mindepth - 1, maxdepth=maxdepth - 1,
                        followannotated=followannotated, _history=_history
                    )

        return result