code: def getmoduleinfo(path):
      
      filename = os.path.basename(path)
      suffixes = map(lambda (suffix, mode, mtype):
                     (-len(suffix), suffix, mode, mtype), imp.get_suffixes())
      suffixes.sort() # try longest suffixes first, in case they overlap
      for neglen, suffix, mode, mtype in suffixes:
          if filename[neglen:] == suffix:
              return filename[:neglen], suffix, mode, mtype
docs: Get the module name, suffix, mode, and module type for a given file.