def METHOD_NAME(self, name):
    if '.' in name:
        script = textwrap.dedent("""\
            try:
                import %s
            except ImportError:
                import %s
            print (%s.__name__)
        """) %(name, name.rsplit('.', 1)[0], name)
    else:
        script = textwrap.dedent("""\
            import %s
            print (%s.__name__)
        """) %(name, name)
    p = subprocess.Popen([sys.executable, '-c', script],
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            cwd=os.path.join(
                os.path.dirname(os.path.abspath(__file__)),
                'testpkg-import-from-init'),
    )
    data = p.communicate()[0]
    if sys.version_info[0] != 2:
        data = data.decode('UTF-8')
    data = data.strip()
    if data.endswith(' refs]'):
        # with --with-pydebug builds
        data = data.rsplit('\n', 1)[0].strip()
    sts = p.wait()
    if sts != 0:
        print (data)
    self.assertEqual(sts, 0)
    return data