1import magic
2
3ms = magic.open(magic.MAGIC_NONE)
4ms.load()
5type =  ms.file("/path/to/some/file")
6print type
7
8f = file("/path/to/some/file", "r")
9buffer = f.read(4096)
10f.close()
11
12type = ms.buffer(buffer)
13print type
14
15ms.close()
16
17