def generate_imports_tip_for_module(obj_to_complete, dir_comps=None, getattr=getattr, filter=lambda name:True):
    '''
        @param obj_to_complete: the object from where we should get the completions
        @param dir_comps: if passed, we should not 'dir' the object and should just iterate those passed as a parameter
        @param getattr: the way to get a given object from the obj_to_complete (used for the completer)
        @param filter: a callable that receives the name and decides if it should be appended or not to the results
        @return: list of tuples, so that each tuple represents a completion with:
            name, doc, args, type (from the TYPE_* constants)
    '''
    ret = []

    if dir_comps is None:
        dir_comps = dir_obj(obj_to_complete)

    for d in dir_comps:

        if d is None:
            continue

        if not filter(d):
            continue

        args = ''
        doc = ''
        retType = TYPE_BUILTIN

        try:
            obj = getattr(obj_to_complete, d)
        except (AttributeError, java.lang.NoClassDefFoundError):
            #jython has a bug in its custom classloader that prevents some things from working correctly, so, let's see if
            #we can fix that... (maybe fixing it in jython itself would be a better idea, as this is clearly a bug)
            #for that we need a custom classloader... we have references from it in the below places:
            #
            #http://mindprod.com/jgloss/classloader.html
            #http://www.javaworld.com/javaworld/jw-03-2000/jw-03-classload-p2.html
            #http://freshmeat.net/articles/view/1643/
            #
            #note: this only happens when we add things to the sys.path at runtime, if they are added to the classpath
            #before the run, everything goes fine.
            #
            #The code below ilustrates what I mean...
            #
            #import sys
            #sys.path.insert(1, r"C:\bin\eclipse310\plugins\org.junit_3.8.1\junit.jar" )
            #
            #import junit.framework
            #print_ dir(junit.framework) #shows the TestCase class here
            #
            #import junit.framework.TestCase
            #
            #raises the error:
            #Traceback (innermost last):
            #  File "<console>", line 1, in ?
            #ImportError: No module named TestCase
            #
            #whereas if we had added the jar to the classpath before, everything would be fine by now...

            ret.append((d, '', '', retType))
            #that's ok, private things cannot be gotten...
            continue
        else:

            isMet = ismethod(obj)
            if isMet[0] and isMet[1]:
                info = isMet[1][0]
                try:
                    args, vargs, kwargs = info.args, info.varargs, info.kwargs
                    doc = info.get_as_doc()
                    r = ''
                    for a in (args):
                        if len(r) > 0:
                            r += ', '
                        r += format_arg(a)
                    args = '(%s)' % (r)
                except TypeError:
                    traceback.print_exc()
                    args = '()'

                retType = TYPE_FUNCTION

            elif isclass(obj):
                retType = TYPE_CLASS

            elif ismodule(obj):
                retType = TYPE_IMPORT

        #add token and doc to return - assure only strings.
        ret.append((d, doc, args, retType))


    return ret

        @param obj_to_complete: the object from where we should get the completions
        @param dir_comps: if passed, we should not 'dir' the object and should just iterate those passed as a parameter
        @param getattr: the way to get a given object from the obj_to_complete (used for the completer)
        @param filter: a callable that receives the name and decides if it should be appended or not to the results
        @return: list of tuples, so that each tuple represents a completion with:
            name, doc, args, type (from the TYPE_* constants)
    
debugger/src/_pydev_bundle/_pydev_jy_imports_tipper.py