title: Python skip the lines which do not have any of starting line in the output
body: <p>I am trying to write a code after getting help from google and So to parse a command output but still getting some problem, as the output what i am expecting continuous there line starting with <code>dn</code> , <code>instance</code> and <code>tag</code> but somehow the very first output only contains <code>dn</code> and <code>tag</code> So,  i want those line which do not have all these three starting strings then just skip those,  as i am learning so not getting the idea to do that.</p>
  <h2>Below is my code:</h2>
  <pre><code>import subprocess as sp
  
  p = sp.Popen(somecmd, shell=True, stdout=sp.PIPE)
  stout = p.stdout.read().decode('utf8')
  output = stout.splitlines()
  startline = [&quot;instance:&quot;, &quot;tag&quot;]
  for line in output:
      print(line)
  </code></pre>
  <h2>Script output:</h2>
  <pre><code>dn: ou=People,ou=pti,o=pt
  tag: pti00631
  
  dn: cn=pti00857,ou=People,ou=pti,o=pt
  instance: Jassu Lal
  tag: pti00857
  
  dn: cn=pti00861,ou=People,ou=pti,o=pt
  instance: Gatti Lal
  tag: pti00861
  </code></pre>
  <h2>Desired output:</h2>
  <pre><code>dn: cn=pti00857,ou=People,ou=pti,o=pt
  instance: Jassu Lal
  tag: pti00857
  
  dn: cn=pti00861,ou=People,ou=pti,o=pt
  instance: Gatti Lal
  tag: pti00861
  </code></pre>