Search for a filename with a specified file extension in all subfolders
    of specified rootDirectory, returns first matching instance.

    :param targetFileName: #TODO: docstring
    :type targetFileName: str
    :param rootDirectory: #TODO: docstring
    :type rootDirectory: str
    :param targetFileExtension: #TODO: docstring
    :type targetFileExtension: str
    :param recursive: bool, specify whether subdirectories should be searched

    :returns: a filepath (str) or None

def searchFileLocation(targetFileName, targetFileExtension, rootDirectory,
                       recursive=True):
    """Search for a filename with a specified file extension in all subfolders
    of specified rootDirectory, returns first matching instance.

    :param targetFileName: #TODO: docstring
    :type targetFileName: str
    :param rootDirectory: #TODO: docstring
    :type rootDirectory: str
    :param targetFileExtension: #TODO: docstring
    :type targetFileExtension: str
    :param recursive: bool, specify whether subdirectories should be searched

    :returns: a filepath (str) or None
    """
    expectedFileName = targetFileName.split('.')[0] + '.' + targetFileExtension
    targetFilePath = None

    if recursive:
        for dirpath, dirnames, filenames in os.walk(rootDirectory):
            for filename in filenames:
                if filename == expectedFileName:
                    targetFilePath = joinpath(dirpath, filename)
                    break
            if targetFilePath is not None:
                break
    else:
        for filename in os.listdir(rootDirectory):
            filePath = joinpath(rootDirectory, filename)
            if not os.path.isfile(filePath):
                continue
            if filename == expectedFileName:
                targetFilePath = filePath
                break

    return targetFilePath