read a logfile and return entries for a program

def extract_logs(self, fname, prg):
        """
        read a logfile and return entries for a program
        """
        op = []
        with open(fname, 'r') as f:
            for line in f:
                if prg in line:
                    op.append(line)
        return op