def find_nth_loc(string=None, search_query=None, n=0):
    """
    Searches the string via the search_query and
    returns the nth index in which the query occurs.
    If there are less than 'n' the last loc is returned
    
    :param string: Input string, to be searched
    :type string: str
    :param search_query: char(s) to find nth occurance of
    :type search_query: str
    :param n: The number of occurances to iterate through
    :type n: int
    
    :return idx: Index of the nth or last occurance of the search_query
    :rtype idx: int
    :return id_count: Number of identifications prior to idx
    :rtype id_count: int
    """

    # Return base case, if there's no string, query or n
    if not string or not search_query or 0 >= n:
        return -1, 0

    # Find index of nth occurrence of search_query 
    idx, pre_idx = -1, -1
    id_count = 0
    for i in range(0, n):

        idx = string.find(search_query, idx+1)
        
        # Exit for loop once string ends
        if idx == -1:

            if pre_idx > 0:
                idx = pre_idx+1 # rest to last location

            # If final discovery is not the search query
            if string[-len(search_query):] != search_query:
                idx = len(string)                
            break
        
        # Keep track of identifications
        if idx != pre_idx:
            id_count += 1
            pre_idx = idx
        
    return idx, id_count