trepan/lib/file.py
def lookupmodule(name):
    """lookupmodule()->(module, file) translates a possibly incomplete
    file or module name into an absolute file name. None can be
    returned for either of the values positions of module or file when
    no or module or file is found.
    """
    if sys.modules.get(name):
        return (sys.modules[name], sys.modules[name].__file__)
    if os.path.isabs(name) and readable(name):
        return (None, name)
    f = os.path.join(sys.path[0], name)
    if readable(f):
        return (None, f)
    root, ext = os.path.splitext(name)
    if ext == '':
        name = name + '.py'
        pass
    if os.path.isabs(name):
        return (None, name)
    for dirname in sys.path:
        while os.path.islink(dirname):
            dirname = os.readlink(dirname)
            pass
        fullname = os.path.join(dirname, name)
        if readable(fullname):
            return (None, fullname)
        pass
    return (None, None)
def lookupmodule(name):
    """lookupmodule()->(module, file) translates a possibly incomplete
    file or module name into an absolute file name. None can be
    returned for either of the values positions of module or file when
    no or module or file is found.
    """
    if sys.modules.get(name):
        return (sys.modules[name], sys.modules[name].__file__)
    if os.path.isabs(name) and readable(name):
        return (None, name)
    f = os.path.join(sys.path[0], name)
    if readable(f):
        return (None, f)
    root, ext = os.path.splitext(name)
    if ext == '':
        name = name + '.py'
        pass
    if os.path.isabs(name):
        return (None, name)
    for dirname in sys.path:
        while os.path.islink(dirname):
            dirname = os.readlink(dirname)
            pass
        fullname = os.path.join(dirname, name)
        if readable(fullname):
            return (None, fullname)
        pass
    return (None, None)
lookupmodule()->(module, file) translates a possibly incomplete
    file or module name into an absolute file name. None can be
    returned for either of the values positions of module or file when
    no or module or file is found.