I'm not sure the reason for the issue (could be the version), but I've been able to workaround it with something like:
mime = magic.from_buffer(data, mime=True)
if mime == None:
# Workaround for issue with libmagic1==5.09-2 in Ubuntu 12.04. Fixed in libmagic 5.11-2.
file_str = magic.from_buffer(data)
if file_str.startswith('Composite Document File V2 Document'):
mime = 'application/msword'
Not great, but gets the job done until it's possible to upgrade the server and get a new version of libmagic.