<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_link_ref(offset: int, length: int, value: bytes, bytecode: bytes) -> bytes: """ Returns the new bytecode with `value` put into the location indicated by `offset` and `length`. """

    try:
        validate_empty_bytes(offset, length, bytecode)
    except ValidationError:
        raise BytecodeLinkingError("Link references cannot be applied to bytecode")

    new_bytes = (
        # Ignore linting error b/c conflict b/w black & flake8
        bytecode[:offset]
        + value
        + bytecode[offset + length :]  # noqa: E201, E203
    )
    return new_bytes