Function
docutils.parsers.rst.directives.choice

Signature

choice(argument, values)

Documentation String

Directive option utility function, supplied to enable options whose argument must be a member of a finite set of possible values (must be lower case). A custom conversion function must be written to use it. For example:

from docutils.parsers.rst import directives

def yesno(argument):
    return directives.choice(argument, ('yes', 'no'))

Raise ValueError if no argument is found or if the argument's value is not valid (not an entry in the supplied list).