def get_runnertype_by_name(runnertype_name):
    """
    Get an runnertype by name.
    On error, raise ST2ObjectNotFoundError.
    """
    try:
        runnertypes = RunnerType.query(name=runnertype_name)
    except (ValueError, ValidationError) as e:
        LOG.error(
            'Database lookup for name="%s" resulted in exception: %s',
            runnertype_name,
            e,
        )
        raise StackStormDBObjectNotFoundError(
            'Unable to find runnertype with name="%s"' % runnertype_name
        )

    if not runnertypes:
        raise StackStormDBObjectNotFoundError(
            'Unable to find RunnerType with name="%s"' % runnertype_name
        )

    if len(runnertypes) > 1:
        LOG.warning(
            "More than one RunnerType returned from DB lookup by name. "
            "Result list is: %s",
            runnertypes,
        )

    return runnertypes[0]

    Get an runnertype by name.
    On error, raise ST2ObjectNotFoundError.
    
st2common/st2common/util/action_db.py