# Utility functions to filter input data

def parse_bool(value, default_val=None):

    if value:
        value = value.lower()
    if default_val is None:
        return {'true': True, 'false': False, "0": False, "1": True}.get(value)
    else:
        return {'true': True, 'false': False, "0": False, "1": True}.get(value, default_val)
