def _reader(path, password, prompt):
        """Read PDF and decrypt if encrypted."""
        pdf = PdfFileReader(path) if not isinstance(path, PdfFileReader) else path
        # Check that PDF is encrypted
        if pdf.isEncrypted:
            # Check that password is none
            if not password:
                pdf.decrypt('')
                # Try and decrypt PDF using no password, prompt for password
                if pdf.isEncrypted and prompt:
                    print('No password has been given for encrypted PDF ', path)
                    password = input('Enter Password: ')
                else:
                    return False
            pdf.decrypt(password)
        return pdf
Read PDF and decrypt if encrypted.