'Convert a dotted module name to path.'

def _tryconvertpyarg(self, x):

    import pkgutil
    try:
        loader = pkgutil.find_loader(x)
    except ImportError:
        return x
    if (loader is None):
        return x
    try:
        path = loader.get_filename(x)
    except AttributeError:
        path = loader.modules[x][0].co_filename
    if loader.is_package(x):
        path = os.path.dirname(path)
    return path
