def _match_abbrev(s, wordmap):
<EOL>if s in wordmap:<EOL><INDENT>return s<EOL><DEDENT>else:<EOL><INDENT>possibilities = [word for word in list(wordmap.keys())<EOL>if word.startswith(s)]<EOL>if len(possibilities) == <NUM_LIT:1>:<EOL><INDENT>return possibilities[<NUM_LIT:0>]<EOL><DEDENT>elif not possibilities:<EOL><INDENT>raise BadOptionError(s)<EOL><DEDENT>else:<EOL><INDENT>possibilities.sort()<EOL>raise AmbiguousOptionError(s, possibilities)<EOL><DEDENT><DEDENT>
_match_abbrev(s : string, wordmap : {string : Option}) -> string

    Return the string key in 'wordmap' for which 's' is an unambiguous
    abbreviation.  If 's' is found to be ambiguous or doesn't match any of
    'words', raise BadOptionError.