<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_local_annotations( cls, target, exclude=None, ctx=None, select=lambda *p: True ):
 """Get a list of local target annotations in the order of their definition. :param type cls: type of annotation to get from target. :param target: target from where get annotations. :param tuple/type exclude: annotation types to exclude from selection. :param ctx: target ctx. :param select: selection function which takes in parameters a target, a ctx and an annotation and returns True if the annotation has to be selected. True by default. :return: target local annotations. :rtype: list """


        result = []

        # initialize exclude
        exclude = () if exclude is None else exclude

        try:
            # get local annotations
            local_annotations = get_local_property(
                target, Annotation.__ANNOTATIONS_KEY__, result, ctx=ctx
            )
            if not local_annotations:
                if ismethod(target):
                    func = get_method_function(target)
                    local_annotations = get_local_property(
                        func, Annotation.__ANNOTATIONS_KEY__,
                        result, ctx=ctx
                    )
                    if not local_annotations:
                        local_annotations = get_local_property(
                            func, Annotation.__ANNOTATIONS_KEY__,
                            result
                        )
                elif isfunction(target):
                    local_annotations = get_local_property(
                        target, Annotation.__ANNOTATIONS_KEY__,
                        result
                    )

        except TypeError:
            raise TypeError('target {0} must be hashable'.format(target))

        for local_annotation in local_annotations:
            # check if local annotation inherits from cls
            inherited = isinstance(local_annotation, cls)
            # and if not excluded
            not_excluded = not isinstance(local_annotation, exclude)
            # and if selected
            selected = select(target, ctx, local_annotation)
            # if three conditions, add local annotation to the result
            if inherited and not_excluded and selected:
                result.append(local_annotation)

        return result