def ask(message, options, allow_empty=False, help=None) -> str:
    """Ask user for input

    Parameters
    ----------
    message : str
        Message.
    options : dict
        ``{command: description}`` mapping.
    allow_empty : bool
        Allow empty string as command.
    help : str
        If provided, add a "help" option that prints ``help``.

    Returns
    -------
    command : str
        The user command.
    """
    options = dict(options)
    if help is not None:
        assert 'help' not in options
        options['help'] = 'display help'
    print(message)
    print('---')
    print('\n'.join(f'{k}:  {v}' for k, v in options.items()))
    while True:
        command = input(" > ")
        if command in options or (allow_empty and not command):
            if help is not None and command == 'help':
                print(help)
            else:
                return command
        else:
            print(f"Invalid entry - type one of ({', '.join(options)})")