new_instruction (Instruction): The new instruction to insert.
after_instruction (Instruction|str | int): The instruction after which to insert the new one (identifier or index).
before_instruction (Instruction|str | int): The instruction before which to insert the new one (identifier or index).
after_instruction (List[Instruction]|Instruction|str | int): The instruction after which to insert the new one (identifier or index).
before_instruction (Instruction|str | int): The instruction before which to insert the new one (identifier or index).#
after_last_of_list and before_first_of_list allow inserting after/before a list of instructions
Raises:
ValueError: if both before and after are provided
IndexError: if it finds multiple places to insert by identifier
Note: the parameter combination after_instruction [list] and before_first_of_list is allowed in this case it will insert AFTER the first list entry usage of this combination is discuraged
"""
# assert only one param is not None
parameters=[after_instruction,before_instruction]
ifparameters.count(None)!=1:
raiseValueError("Only one parameter is allowed to be specified")