def string_y_n(string, default=None):
    """
    Strict mapping of a given string to a boolean.

    If it is `'y'` or `'Y'`, `True` is returned.
    If it is `'n'` or `'N'`, `True` is returned.
    If it is empty or None (evaluates to False), and `default` is set, `default` is returned.
    Else a `ValueError` is raised.

    :param string: The input
    :type  string: str

    :param default: default result for empty input
    :type  default: None | bool

    :raises ValueError: If it is not any of ['y', 'Y', 'n', 'N']
    :return: result (True/False/default)
    :rtype:  bool
    """
    if not string and default is not None:
        return default
    if string not in ['y', 'Y', 'n', 'N']:
        raise ValueError('Please enter y or n.')
    if string == 'y' or string == 'Y':
        return True
    if string == 'n' or string == 'N':
        return False
        # end if