def recursive_input(input_label, type_class):
    '''Recursive user input prompter with type checker

    Args
    ----
    type_class: type
        name of python type (e.g. float, no parentheses)

    Returns
    -------
    output: str
        value entered by user converted to type `type_class`

    Note
    ----
    Use `ctrl-c` to exit input cycling
    '''
    import sys

    type_str = str(type_class).split("'")[1]

    msg = 'Enter {} (type `{}`): '.format(input_label, type_str)

    # Catch `Ctrl-c` keyboard interupts
    try:
        output = input(msg)
        print('')
        # Type class input, else cycle input function again
        try:
            output = type_class(output)
            return output
        except:
            print('Input must be of type `{}`\n'.format(type_str))
            return recursive_input(input_label, type_class)

    # Keyboard interrupt passed, exit recursive input
    except KeyboardInterrupt:
        return sys.exit()
Recursive user input prompter with type checker

    Args
    ----
    type_class: type
        name of python type (e.g. float, no parentheses)

    Returns
    -------
    output: str
        value entered by user converted to type `type_class`

    Note
    ----
    Use `ctrl-c` to exit input cycling