def _tryconvertpyarg(self, x):
try:<EOL><INDENT>with _patched_find_module():<EOL><INDENT>loader = pkgutil.find_loader(x)<EOL><DEDENT><DEDENT>except ImportError:<EOL><INDENT>return x<EOL><DEDENT>if loader is None:<EOL><INDENT>return x<EOL><DEDENT>try:<EOL><INDENT>with _patched_find_module():<EOL><INDENT>path = loader.get_filename(x)<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>path = loader.modules[x][<NUM_LIT:0>].co_filename<EOL><DEDENT>if loader.is_package(x):<EOL><INDENT>path = os.path.dirname(path)<EOL><DEDENT>return path<EOL>
Convert a dotted module name to path.