def search(self, entity_type, property_name, search_string):

        params = {
            "entity-type": entity_type,
            "expand": entity_type,
            "property-search-restriction": {
                "property": {"name": property_name, "type": "STRING"},
                "match-mode": "CONTAINS",
                "value": search_string,
            }
        }

        params = {
            'entity-type': entity_type,
            'expand': entity_type,
        }
        # Construct XML payload of the form:
        # <property-search-restriction>
        #   <property>
        #     <name>email</name>
        #     <type>STRING</type>
        #   </property>
        #   <match-mode>EXACTLY_MATCHES</match-mode>
        #   <value>bob@example.net</value>
        # </property-search-restriction>

        root = etree.Element('property-search-restriction')

        property_ = etree.Element('property')
        prop_name = etree.Element('name')
        prop_name.text = property_name
        property_.append(prop_name)
        prop_type = etree.Element('type')
        prop_type.text = 'STRING'
        property_.append(prop_type)
        root.append(property_)

        match_mode = etree.Element('match-mode')
        match_mode.text = 'CONTAINS'
        root.append(match_mode)

        value = etree.Element('value')
        value.text = search_string
        root.append(value)

        # Construct the XML payload expected by search API
        payload = '<?xml version="1.0" encoding="UTF-8"?>\n' + etree.tostring(root).decode('utf-8')

        # We're sending XML but would like a JSON response
        session = self._build_session(content_type='xml')
        session.headers.update({'Accept': 'application/json'})
        response = session.post(self.rest_url + "/search", params=params, data=payload, timeout=self.timeout)

        if not response.ok:
            return None

        return response.json()
Performs a user search using the Crowd search API.
dataset/ETHPy150Open pycontribs/python-crowd/crowd.py/CrowdServer.search