def search(dataset, node, lat=None, lng=None, distance=100, ll=None, ur=None, start_date=None, end_date=None, where=None, max_results=50000, starting_number=1, sort_order="DESC", api_key=None):
    root, body = create_root_request()
    
    el = create_request_type(body, "search")
    
    create_dataset_element(el, dataset)
    create_node_element(el, node)
    
    # Latitude and longitude take precedence over ll and ur
    if lat and lng:
        
        try:
            import pyproj
            from shapely import geometry
        except ImportError:
            raise USGSDependencyRequired("Shapely and PyProj are required for spatial searches.")
        
        prj = pyproj.Proj(proj='aeqd', lat_0=lat, lon_0=lng)
        half_distance = 0.5 * distance
        box = geometry.box(-half_distance, -half_distance, half_distance, half_distance)
        
        lngs, lats = prj(*box.exterior.xy, inverse=True)
        
        ll = { "longitude": min(*lngs), "latitude": min(*lats) }
        ur = { "longitude": max(*lngs), "latitude": max(*lats) }
    
    if ll and ur:
        
        create_service_class_coordinate(el, "lowerLeft", latitude=ll["latitude"], longitude=ll["longitude"])
        create_service_class_coordinate(el, "upperRight", latitude=ur["latitude"], longitude=ur["longitude"])
        
    if start_date:
        
        start_date_el = SubElement(el, "startDate")
        start_date_el.set("xsi:type", "xsd:string")
        start_date_el.text = start_date
        
    if end_date:
        
        end_date_el = SubElement(el, "endDate")
        end_date_el.set("xsi:type", "xsd:string")
        end_date_el.text = end_date
    
    if where:
        
        # TODO: Support more than AND key/value equality queries
        additional_criteria_el = SubElement(el, "additionalCriteria")
        
        filter_type_el = SubElement(additional_criteria_el, "filterType")
        filter_type_el.text = "and"
        
        child_filters_el = SubElement(additional_criteria_el, "childFilters")
        for field_id, value in where.iteritems():
            child_item_el = SubElement(child_filters_el, "item")
            field_id_el = SubElement(child_item_el, "fieldId")
            field_id_el.text = str(field_id)
            item_filter_type_el = SubElement(child_item_el, "filterType")
            item_filter_type_el.text = "value"
            operand_el = SubElement(child_item_el, "operand")
            operand_el.text = "="
            value_el = SubElement(child_item_el, "value")
            value_el.text = str(value)

    if max_results:
        
        max_results_el = SubElement(el, "maxResults")
        max_results_el.set("xsi:type", "xsd:int")
        max_results_el.text = str(max_results)
        
    if starting_number:
        
        starting_number_el = SubElement(el, "startingNumber")
        starting_number_el.set("xsi:type", "xsd:int")
        starting_number_el.text = str(starting_number)
        
    if sort_order:
        
        sort_order_el = SubElement(el, "sortOrder")
        sort_order_el.set("xsi:type", "xsd:string")
        sort_order_el.text = sort_order
    
    if api_key:
        create_api_key_element(el, api_key)
    
    return tostring(root)
Testing GitHub check_repository with not found error and public
dataset/ETHPy150Open mapbox/usgs/usgs/soap.py/search--crossover with--dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/hostingsvcs/tests/test_github.py/GitHubTests.test_check_repository_public_not_found