<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def prompt_choice(prompt, possibilities, default=None, only_in_poss=True, show_default=True, prompt_suffix=': ', color=None):
 """ Prompt for a string in a given range of possibilities. This also sets the history to the list of possibilities so the user can scroll is with the arrow to find what he wants, If only_in_poss is False, you are not guaranteed that this will return one of the possibilities. """


    assert len(possibilities) >= 1
    assert not only_in_poss or default is None or default in possibilities, '$s not in possibilities' % default

    contains_spaces = any(' ' in poss for poss in possibilities)

    possibilities = sorted(possibilities)

    readline.clear_history()
    for kw in possibilities:
        readline.add_history(kw)

    def complete(text):
        return [t for t in possibilities if t.startswith(text)]

    while 1:
        r = prompt_autocomplete(prompt, complete, default, contains_spaces=contains_spaces, 
                                show_default=show_default, prompt_suffix=prompt_suffix, color=color)
        if not only_in_poss or r in possibilities:
            break
        print('%s is not a possibility.' % r)
        
    readline.clear_history()

    return r