def to_data_string_with_default(value, arg=''):
    """ Given a Python boolean value converts it to string representation so
    we can use it in HTML data attributes. If value is None use given default
    or '' if default is not provided.

    -----       ------
    Value       Output
    -----       ------
    True        "true"
    False       "false"
    None        arg
    """
    if isinstance(value, bool):
        if value:
            return 'true'
        return 'false'

    return value or arg