def METHOD_NAME(identifier: str, tag: str, max_length: int) -> str:
    assert len(tag) <= max_length
    remaining_length = max_length - len(tag)
    remaining_overflow = remaining_length % 2
    identifier = identifier[:remaining_length // 2 + remaining_overflow] + tag + identifier[len(identifier) - remaining_length // 2:]
    assert len(identifier) == max_length
    return identifier