'Get lines from a file, which may or may not be compressed'

def get_file_lines(self, filename):

    lines = []
    ftype = utils.subprocess_get(self.logger, ('/usr/bin/file    %s' % filename))
    if (ftype.find('gzip') != (-1)):
        try:
            import gzip
            f = gzip.open(filename, 'r')
            lines = f.readlines()
            f.close()
        except:
            pass
    elif (ftype.find('text') != (-1)):
        f = open(filename, 'r')
        lines = f.readlines()
        f.close()
    return lines
