code: def type(filename):
      
      assert isinstance(filename, basestring)
      while 1:
          filename, suffix = os.path.splitext (filename)
          if not suffix: return None
          suffix = suffix[1:]
  
          if suffix in __suffixes_to_types:
              return __suffixes_to_types[suffix]
docs: Returns file type given it's name. If there are several dots in filename,
          tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and
          "so"  will be tried.