def modname(qualname):
    candidate = qualname[0]
    for elem in qualname[1:]:
        if ".".join((candidate, elem)) not in sys.modules:
            return candidate
        candidate = ".".join((candidate, elem))

# nose generates two types of test names: unittest-based test cases
# are named "Test(<module.class testMethod=method>"). Non-unittest
# test cases (functions and methods) simply have a dotted name like
# "Test(module.class.method)".
dataset/ETHPy150Open eventbrite/nose-knows/src/knows/nose_plugin.py/modname/original