def get_reaction_from_name(reactions, name):
    """Return reaction with name.

    Args:
        reactions (list(reactions)): the reactions.
        name (str): name of the desired reaction.

    Returns:
        reaction: the corresponding reaction.

    """
    matches = [r for r in reactions if r.name == name]
    if len(matches) > 1:
        raise UserWarning('ERROR: duplicate reactions in model.')
    elif len(matches) == 0:
        raise UserWarning('WARNING: could not find reaction: ' + name)
    else:
        return matches[0]