import re


def osFindValue(obj, searchTerm, searchMethod):
    """Internal helper method!
    Generic search method to search a string or int for a searchTerm. Different search methods can be
    provided for different ways of searching.

    Args:
        obj (str|int): The object that is being searched in
        searchTerm (str|int): The thing we want to find
        searchMethod (str): If searching in strings, it can be "exact", "contains", "regex" or "regex-case"
                            If searching in integers it can only be "exact"

    Raises:
        ValueError: If an invalid searchmethod is provided

    Returns:
        bool: If the searchterm is found then True is returned, otherwise False
    """
    if type(obj) == int and type(searchTerm) == int:
        if searchMethod == "exact":
            return searchTerm == obj
        else:
            raise ValueError("When searching integers the method should be: exact")

    if type(obj) == str and type(searchTerm) == str:
        if searchMethod == "exact":
            return searchTerm == obj
        elif searchMethod == "contains":
            return searchTerm in obj
        elif searchMethod == "regex":
            return re.search(searchTerm, obj) is not None
        elif searchMethod == "regex-case":
            return re.search(searchTerm, obj, re.IGNORECASE) is not None
        raise ValueError("Search method should be one of: exact, contains, regex, regex-case")
    return False