'See if the file is a structured storage file or a normal file
and then return an ifilter interface by calling the appropriate bind/load function'

def _bind_to_filter(self, fileName):

    if pythoncom.StgIsStorageFile(fileName):
        self.stg = pythoncom.StgOpenStorage(fileName, None, (storagecon.STGM_READ | storagecon.STGM_SHARE_DENY_WRITE))
        try:
            self.f = ifilter.BindIFilterFromStorage(self.stg)
        except pythoncom.com_error as e:
            if (e[0] == (-2147467262)):
                self.f = ifilter.LoadIFilter(fileName)
            else:
                raise
    else:
        self.f = ifilter.LoadIFilter(fileName)
        self.stg = None
