title: LDAP query in python
body: <p>I want to execute the following query in the ldap</p>
  
  <pre><code>ldapsearch -h hostname -b dc=ernet,dc=in -x "(&amp;(uid=w2lame)(objectClass=posixAccount))" gidnumber
  ldapsearch -h hostname -b dc=ernet,dc=in -x "(&amp;(gidNumber=1234)(objectClass=posixGroup))" cn
  </code></pre>
  
  <p>And use the variables thus obtained. How can I do that?</p>