def modify(self,entry,attr,values):
     newAttrs=BasicAttributes(1)
     newattr=BasicAttribute(attr)
     for value in values:
         newattr.add(value)
     newAttrs.put(newattr)
     self.ctx.modifyAttributes(entry,DirContext.REPLACE_ATTRIBUTE,newAttrs)
 def add(self,loc,entry):
     ''' Add a new entry to the LDAP based on the provided hash that contains entry attributes and corresponding values '''
     ldapentry=BasicAttributes()
     for (attr,values) in entry.items(): # add hashed attributes one by one
         attribute=BasicAttribute(attr)
         if type(values) is ListType: # add list items one by one
             for value in values:
                 attribute.add(value)
         else:
             attribute.add(values)
         #print str(attribute)
         ldapentry.put(attribute)
     self.ctx.createSubcontext(loc,ldapentry)