def user_prompt(prompt_string, default=None, inlist=None):
    """
    Takes a prompt string, and asks user for answer
        sets a default value if there is one
        keeps prompting if the value isn't in inlist
        splits a string list with commas into a list
    """
    prompt_string = '%s [%s]: ' % (
        prompt_string, default) if default else prompt_string
    output = input(prompt_string)
    output = default if output == '' else output
    if inlist:
        assert isinstance(inlist, list)
        while output not in inlist:
            output = input(prompt_string)
    output = [x.strip() for x in output.split(',')] if (
        isinstance(output, str) and ',' in output) else output
    return output