code: def search_directory(self, **kwargs):
          search_response = self.request('SearchDirectory', kwargs)
          result = {}
          items = {
              "account": zobjects.Account.from_dict,
              "domain": zobjects.Domain.from_dict,
              "dl": zobjects.DistributionList.from_dict,
              "cos": zobjects.COS.from_dict,
              "calresource": zobjects.CalendarResource.from_dict
          }
          for obj_type, func in items.items():
              if obj_type in search_response:
                  if isinstance(search_response[obj_type], list):
                      result[obj_type] = [
                          func(v) for v in search_response[obj_type]]
                  else:
                      result[obj_type] = func(search_response[obj_type])
          return result