pwtools
Try to get the name attribute from file-like objects. If it fails (fh=cStringIO.StringIO(), fh=StringIO.StringIO(), fh=gzip.open(), …), then return a dummy name.