Here there my working python script:

```
#!/usr/bin/python

import ldap, sys

l = ldap.initialize('ldap://myldapserver:389')
username = "uid=%s,OU=folder1,OU=myCompany,O=MyCompanyGroup" % "myID"
password = "mypassword"
try:
  l.protocol_version = ldap.VERSION3
  l.simple_bind_s(username, password)
  valid = True
  print "OK"
  l.unbind()
except Exception, error:
  print error

```

Now I would like to bind the user, just only specifying "O=MyCompanyGroup", and searching for the uid on that subtree. For example I can filter based on "**inetOrgPerson**"

I tried 

```
 username = "(&(objectClass=inetOrgPerson )(uid=%s)(O=MyCompanyGroup))" % "myID"

```

but I get Invalid credentials.

Thanks!
Riccardo