Determine the pseudopotential names from the output

def get_pp_name(self):
        '''Determine the pseudopotential names from the output'''
        ppnames = []
        # Find the number of atom types
        natomtypes = int(self._get_line('number of atomic types', self.outputf).split()[5])
        # Find the pseudopotential names
        with open(self.outputf) as fp:
            for line in fp:
                if "PseudoPot. #" in line:
                    ppnames.append(Scalar(value=next(fp).split('/')[-1].rstrip()))
                    if len(ppnames) == natomtypes:
                        return Value(scalars=ppnames)
            raise Exception('Could not find %i pseudopotential names'%natomtypes)