code: def get_parent_until(path):
      
      dirname = osp.dirname(path)
      try:
          mod = osp.basename(path)
          mod = osp.splitext(mod)[0]
          imp.find_module(mod, [dirname])
      except ImportError:
          return
      items = [mod]
      while 1:
          items.append(osp.basename(dirname))
          try:
              dirname = osp.dirname(dirname)
              imp.find_module('__init__', [dirname + os.sep])
          except ImportError:
              break
      return '.'.join(reversed(items))
docs: Given a file path, determine the full module path.
  
      e.g. '/usr/lib/python2.7/dist-packages/numpy/core/__init__.pyc' yields
      'numpy.core'