def _handle_possible_exclusion_host_pattern(pattern):
    """
    Check if pattern starts with "!", meaning matching hosts will be excluded

    :returns: exclude, sanitized_pattern
    """
    # if the pattern starts with !, exclude the matching domains
    exclude = pattern.startswith("!")
    if exclude:
        # clean pattern to remove the '!' char
        pattern = pattern[1:]
    return exclude, pattern