code: def linkable_users(self):
          
  
          # Only users with at nost these roles are displayed
          linkable_roles = {"Authenticated", "Member", "Client"}
  
          out = []
          for user in self.get_users():
              userid = user.get("id", None)
  
              if userid is None:
                  continue
  
              # Skip users which are already linked to a Contact
              contact = Contact.getContactByUsername(userid)
              labcontact = LabContact.getContactByUsername(userid)
  
              if contact or labcontact:
                  continue
              if self.is_contact():
                  # Checking Plone user belongs to Client group only. Otherwise,
                  # weird things could happen (a client contact assigned to a
                  # user with labman privileges, different contacts from
                  # different clients assigned to the same user, etc.)
                  user_roles = security.get_roles(user=userid)
                  if not linkable_roles.issuperset(set(user_roles)):
                      continue
              userdata = {
                  "userid": userid,
                  "email": user.get("email"),
                  "fullname": user.get("title"),
              }
  
              # filter out users which do not match the searchstring
              if self.searchstring:
                  s = self.searchstring.lower()
                  if not any(
                          map(lambda v: re.search(s, str(v).lower()),
                              userdata.values())):
                      continue
  
              # update data (maybe for later use)
              userdata.update(user)
  
              # Append the userdata for the results
              out.append(userdata)
  
          out.sort(lambda x, y: cmp(x["fullname"], y["fullname"]))
          return out
docs: Search Plone users which are not linked to a contact or lab contact