def find_directory_entry_by_name(blend_shape, name):
    """
    Find and return the targetDirectory with the given name, or None if it doesn't exist.
    """
    for directory_entry in blend_shape.targetDirectory:
        if directory_entry.directoryName.get() == name:
            return directory_entry
    return None