def search(**criteria):
    """
    Search registered *component* classes matching the given criteria.

    :param criteria: search criteria of the form: ``a='1', b='x'``
    :return: parts registered with the given criteria
    :rtype: :class:`set`

    Will return an empty :class:`set` if nothing is found.

    ::

        from cqparts.search import search
        import cqparts_motors  # example of a 3rd party lib

        # Get all DC motor classes
        dc_motors = search(type='motor', current_class='dc')

        # For more complex queries:
        air_cooled = search(cooling='air')
        non_aircooled_dcmotors = dc_motors - air_cooled
        # will be all DC motors that aren't air-cooled
    """
    # Find all parts that match the given criteria
    results = copy(class_list)  # start with full list
    for (category, value) in criteria.items():
        results &= index[category][value]

    return results