\begin{Verbatim}[commandchars=\\\{\}]
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{filter\PYGZus{}func} \PYG{o}{=} \PYG{k}{lambda} \PYG{n}{hit}\PYG{p}{:} \PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{hit}\PYG{o}{.}\PYG{n}{hsps}\PYG{p}{)} \PYG{o}{\PYGZgt{}} \PYG{l+m+mi}{1}     \PYG{c+c1}{\PYGZsh{} the callback function}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{blast\PYGZus{}qresult}\PYG{p}{)}      \PYG{c+c1}{\PYGZsh{} no. of hits before filtering}
\PYG{g+go}{100}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n}{filtered\PYGZus{}qresult} \PYG{o}{=} \PYG{n}{blast\PYGZus{}qresult}\PYG{o}{.}\PYG{n}{hit\PYGZus{}filter}\PYG{p}{(}\PYG{n}{filter\PYGZus{}func}\PYG{p}{)}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{filtered\PYGZus{}qresult}\PYG{p}{)}   \PYG{c+c1}{\PYGZsh{} no. of hits after filtering}
\PYG{g+go}{37}
\PYG{g+gp}{\PYGZgt{}\PYGZgt{}\PYGZgt{} }\PYG{k}{for} \PYG{n}{hit} \PYG{o+ow}{in} \PYG{n}{filtered\PYGZus{}qresult}\PYG{p}{[:}\PYG{l+m+mi}{5}\PYG{p}{]:}    \PYG{c+c1}{\PYGZsh{} quick check for the hit lengths}
\PYG{g+gp}{... }    \PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}}\PYG{l+s+si}{\PYGZpc{}s}\PYG{l+s+s2}{ }\PYG{l+s+si}{\PYGZpc{}i}\PYG{l+s+s2}{\PYGZdq{}} \PYG{o}{\PYGZpc{}} \PYG{p}{(}\PYG{n}{hit}\PYG{o}{.}\PYG{n}{id}\PYG{p}{,} \PYG{n+nb}{len}\PYG{p}{(}\PYG{n}{hit}\PYG{o}{.}\PYG{n}{hsps}\PYG{p}{)))}
\PYG{g+go}{gi|301171322|ref|NR\PYGZus{}035857.1| 2}
\PYG{g+go}{gi|262205330|ref|NR\PYGZus{}030198.1| 2}
\PYG{g+go}{gi|301171447|ref|NR\PYGZus{}035871.1| 2}
\PYG{g+go}{gi|262205298|ref|NR\PYGZus{}030190.1| 2}
\PYG{g+go}{gi|270132717|ref|NR\PYGZus{}032716.1| 2}
\end{Verbatim}
