def convert_to_value(item, target_values, value, matching=True):
    """Convert target strings to NaN.
    
    Converts target strings listed in target_values to value so they can be
    processed within a DataFrame, such as for removing specific rows. If
    matching=False, strings that do not those listed in values are converted to
    value. Note that it cannot take None as a value in values.
    
    Args:
        item (str): String to be checked. item is converted to a string if
        necessary.
        target_values (list): Values to be checked. If found, value is returned
        (if matching=True) or item is returned. If matching=False, this is
        reversed.
        value (str): Value that is to be returned if taget_values check is
        positive (respective to matching)
        matching (bool): If True, matching values are returned as value and 
        non-matching are returned as passed (item). If False, non-matching
        values are returned as NaN and matching values are returned as passed
        (item).
        
    Returns:
        item or value (str): Depending on status of matching and if found or
        not.
    """
    # Convert to value if item is found in taget_values
    if matching:
        if str(item) in map(str, target_values):
            return value
        else:
            return item
        # Convert item to value if not found in values
    else:
        if str(item) in map(str, target_values):
            return item
        else:
            return value