def insert_after(path, value_to_find, code_to_insert):
    """Insert code after any first of value.

    Args:
        path: Path to file
        value_to_find: search term.
        code_to_insert: Text to insert before search term.

    Returns: Text of modified file.
    """
    content = []
    added = False
    for line in path.open():
        content.append(line)
        if value_to_find in line and not added:
            content.append(code_to_insert)
            added = True
    return ''.join(content)
