<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert(self, infile, item=None):
 """Convert an input file to h5features based on its extension. :raise IOError: if `infile` is not a valid file. :raise IOError: if `infile` extension is not supported. """

        if not os.path.isfile(infile):
            raise IOError('{} is not a valid file'.format(infile))

        if item is None:
            item = os.path.splitext(infile)[0]

        ext = os.path.splitext(infile)[1]
        if ext == '.npz':
            self.npz_convert(infile, item)
        elif ext == '.mat':
            self.mat_convert(infile, item)
        elif ext == '.h5':
            self.h5features_convert(infile)
        else:
            raise IOError('Unknown file format for {}'.format(infile))