def boolean(prompt=None, yes='y', no='n', default=None, sensitive=False,
            partial=True):
    """Prompt for a yes/no response.

    Parameters
    ----------
    prompt : str, optional
        Use an alternative prompt.
    yes : str, optional
        Response corresponding to 'yes'.
    no : str, optional
        Response correspnding to 'no'.
    default : bool, optional
        The return value if user inputs empty response.
    sensitive : bool, optional
        If True, input is case sensitive.
    partial : bool, optional
        Can user type 'y' or 'ye' for 'yes' and 'n' for 'no'?

    Returns
    -------
    bool
        Either True (if user selects 'yes') or False (if user selects 'no')

    """
    def norm(x):
        return x if sensitive else str(x).lower()

    def to_bool(c):
        """Business logic for converting input to boolean."""
        if partial and len(c):
            if norm(yes).startswith(norm(c)):
                return True
            elif norm(no).startswith(norm(c)):
                return False
        else:
            if norm(yes) == norm(c):
                return True
            elif norm(no) == norm(c):
                return False
        raise ValueError

    if prompt is None:
        y = '[{}]'.format(yes) if default is True else yes
        n = '[{}]'.format(no) if default is False else no
        prompt = '{y}/{n}? '.format(y=y, n=n)

    s = input(prompt)
    if (default is not None) and not s:
       return default

    try:
        return to_bool(s)
    except ValueError:
        return boolean(prompt=prompt, yes=yes, no=no, default=default,
                       sensitive=sensitive, partial=partial)