def find_module(module_name, path=None):
    """ Returns the filename for the specified module. """

    components = module_name.split('.')

    try:
        # Look up the first component of the module name (of course it could be
        # the *only* component).
        f, filename, description = imp.find_module(components[0], path)

        # If the module is in a package then go down each level in the package
        # hierarchy in turn.
        if len(components) > 0:
            for component in components[1:]:
                f,filename,description = imp.find_module(component, [filename])

    except __HOLE__:
        filename = None

    return filename

#### EOF ######################################################################
dataset/ETHPy150Open enthought/envisage/envisage/developer/code_browser/enclbr.py/find_module