def find(**criteria):
    """
    Find a single *component* class with the given criteria.

    Finds classes indexed with :meth:`register`

    :raises SearchMultipleFoundError: if more than one result found
    :raises SearchNoneFoundError: if nothing found

    ::

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

        # get a specific motor class
        motor_class = find(type='motor', part_number='ABC123X')
        motor = motor_class(shaft_diameter=6.0)
    """
    # Find all parts that match the given criteria
    results = search(**criteria)

    # error cases
    if len(results) > 1:
        raise SearchMultipleFoundError("%i results found" % len(results))
    elif not results:
        raise SearchNoneFoundError("%i results found" % len(results))

    # return found Part|Assembly class
    return results.pop()
Find a single *component* class with the given criteria.

    Finds classes indexed with :meth:`register`

    :raises SearchMultipleFoundError: if more than one result found
    :raises SearchNoneFoundError: if nothing found

    ::

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

        # get a specific motor class
        motor_class = find(type='motor', part_number='ABC123X')
        motor = motor_class(shaft_diameter=6.0)