\DocumentMetadata{testphase={phase-III},pdfversion=2.0,pdfstandard=A-4}
\documentclass[customdriver=hgeneric-testphase,]{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language=Python]
import numpy as np
def incmatrix(genl1,genl2):
m = len(genl1)
n = len(genl2)
M = None #to become the incidence matrix
VT = np.zeros((n*m,1), int) #dummy variable
\end{lstlisting}
\end{document}
Output:
./a.tex:20: Package tagpdf Error: The number of automatic begin (7) and end (8)
(tagpdf) text-unit para hooks differ!
For immediate help type H <return>.
...
l.20 \end{document}
This quite probably a coding error and the structure will be wrong!
./a.tex:20: Package tagpdf Error: there is no open structure on the stack
Type <return> to continue.
...
l.20 \end{document}
Testcase:
Output: